Solved

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

Posted on 2015-01-26
3
3,409 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
ID: 40571210
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
ID: 40571725
Perfect, Thank you.
0
 

Expert Comment

by:grafik77
ID: 40869267
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
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)

863 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

25 Experts available now in Live!

Get 1:1 Help Now