Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
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…

810 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