Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2015-01-26
3
3,809 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

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…

790 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