Adding "bServerSide": true to datatable giving error TypeError: g is null

I am working in JavaScript and Java. Using jQuery DataTables the error appears while I am adding "bServerSide": true

to the data table.

TypeError: g is null

... ata a.fnServerData.call (J, a.sAjaxSource, h.map (b, function (a, b) {return {name :? b, Valu ...

jquery .... min.js (line 33)

TypeError: c is undefined

After adding "sAjaxSource"

it gives another error:

i [n] - undefined

The jQuery code is below.

 table2 = $('#table2').dataTable(
            {
                "info": false,
                "bLengthChange": false,
                "bFilter": true,
                "bServerSide" : true,
                "oLanguage": {"sSearch": ""},
                responsive: true,
                "paging": false,
               "sAjaxSource" : basePath+'/secure/bartender/list.json',
                "aoColumns" : [
                        {
                            "mData" : "srNo",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "craftBeerName",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "tapStatus",
                            "bVisible":true 
                        }, 
                        {
                            "mData" : "action",
                            "bSortable":false 
                        }

                ],


                "fnServerData" : function(sSource, aoData, fnCallback) {
                $.ajax({
                "dataType" : 'json',
                "type" : "GET",
                "url" : sSource,
                "data" : aoData,
                "success" : fnCallback
                });
                },
                "sPaginationType" : "full_numbers"
//                "iDisplayLength": 2
            });

      

Why is this happening?

+3


source to share


1 answer


You have a missing comma after "paging": false

.



Also make sure you have the same number of columns <th></th>

in the <thead>

/ sections <tfoot>

as you have in your data you defined columns 4

with aoColumns

.

0


source







All Articles