Uncaught TypeError: Cannot read property 'length' of undefined
Uncaught TypeError: Cannot read property 'length' of undefined
marandi
Posts: 2Questions: 0Answers: 0
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 :( !
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 :( !
This discussion has been closed.
Replies
Allan