Uncaught TypeError: Cannot read property 'length' of undefined

Uncaught TypeError: Cannot read property 'length' of undefined

marandimarandi Posts: 2Questions: 0Answers: 0
edited May 2013 in DataTables 1.9
hi guys , i use Datatable 1.9 inside of codeigniter framework !
well u know everything works great when i use static data s ! but in ajax way i have a problem
here is my initializing datatable and Json data !

[code]
oTable = $('.Reza').dataTable({
"bJQueryUI": false,
"bAutoWidth": false,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://localhost/neuron/index.php/company/list_all",
"sServerMethod": "POST",
"sDom": '<"H"fl>t<"F"ip>'
});
[/code]

json data :
[code]
{
"sEcho":0,
"iTotalRecords":8,
"iTotalDisplayRecords":8,
"aaData":[
[
"Reza Marandi",
"administrator",
"110",
"Iran",
"Mashhad"
],
[
"Reza MM",
"mar@mar.ir",
"110",
"United Kingdom",
"sdfgsdg"
],
[
"Reza MM",
"mar@mar.ir",
"110",
"United Kingdom",
"sdfgsdg"
],
[
"Reza Joooon",
"reza@marandi.ir",
"m110",
"Bouvet Island",
"asdasd"
],
[
"Reza Marandi",
"marandi@marandi.ir",
"0",
"",
""
],
[
"Reza Jooo222222222on",
"reza@marandi.ir2",
"0",
"",
""
],
[
"Reza Jooo222222222on",
"reza@marandi.ir2",
"0",
"",
""
],
[
"Reza Masdasdasdasd",
"mar@mar.ir2",
"0",
"",
""
]
],
"sColumns":"Name,UserName,Password,Country,City"
}
[/code]


and here is my view code :

[code]

<!-- Table with always visible toolbar -->


Companies Users





Name ( Username )
Groups Name
City
Address
Actions










<!-- / Table with always visible toolbar -->

[/code]



in this situation i got this error :

[code]Uncaught TypeError: Cannot read property 'length' of undefined [/code]

and when i remove "sDom": '<"H"fl>t<"F"ip>' everything works great again but my style goes stupid ! please help , i dont know what to do :( !

Replies

  • marandimarandi Posts: 2Questions: 0Answers: 0
    PS : i forgot to change the class of table , the right class is the Reza ! so its reza not dTable ! thanks , helpppp
  • allanallan Posts: 63,389Questions: 1Answers: 10,449 Site admin
    Link to a test case please: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
This discussion has been closed.