Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82436

Uncaught TypeError: Cannot read property 'length' of undefined

$
0
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 !

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>'
    });

json data :
{
   "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"
}


and here is my view code :


<!-- Table with always visible toolbar -->
                    
                    <div class="widget">
                        <div class="whead"><h6>Companies Users</h6><div class="clear"></div></div>
                        <div id="dyn" class="hiddenpars">
                            <a class="tOptions" title="Options"><img src="<?php echo base_url(); ?>/assets/images/icons/options" alt="" /></a>
                            <table cellpadding="0" cellspacing="0" border="0" class="Reza" id="dynamic">
                                <thead>
                                    <tr>
                                        <th>Name ( Username )<span class="sorting" style="display: block;"></span></th>
                                        <th>Groups Name</th>
                                        <th>City</th>
                                        <th>Address</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table> 
                        </div>
                        <div class="clear"></div> 
                    </div>   

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




in this situation i got this error :

Uncaught TypeError: Cannot read property 'length' of undefined 

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 :( !

Viewing all articles
Browse latest Browse all 82436

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>