Solved

Cannot read property 'length' of undefined - JQuery Datatables Plugins

Posted on 2015-01-26
3
3,082 Views
Last Modified: 2015-07-06
I'm trying to make it Jquery Datatables plugins work by fetching fetching data while I'm doing that I'm getting the following error,

Anybody points me what is causing this error to be happen?
"Cannot read property 'length' of undefined - JQuery Datatables Plugins"

*! DataTables 1.10.2 */

Demo::  http://plnkr.co/edit/hpt2A4wWxbDGv5lhenEW?p=preview
0
Comment
Question by:nisarkhan
3 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
Comment Utility
Hi,
two issues:
- in the HTML the data-name for the third column should be
<th data-name="CompanyLegalName" data-width="160">Name</th>

Open in new window

(name typo: LegalCompanyName <> CompanyLegalName)
- the JSON is not the configured format - you configured the data inside the results property of the JSON object. Therefore if you add on top of your data.json a
 {"results":
and at the end the closing }
then it works.
HTH
Rainer
0
 
LVL 7

Author Closing Comment

by:nisarkhan
Comment Utility
Perfect, Thank you.
0
 

Expert Comment

by:grafik77
Comment Utility
How would you just do this with jquery not NG? Like the example on datatables.net . http://localhost:8888/Datatables/examples/data_sources/ajax.html
I am not having luck with that..locationsdash.html
locations.txt
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now