Jquery Datatable sending many ajax requests -
Jquery Datatable sending many ajax requests -
i using jquery datatable 1.9 , facing weird problem.my code sending many(equal column in table) requests server.below code , using :
tablecontainer.datatable({ sdom: '<"row"<"span6"l><"span6">r>t<"row"<"span6"i><"span6"p>>', spaginationtype: 'bootstrap', bprocessing: true, bserverside: true, bstatesave: false, bpaginate: true, olanguage: { slengthmenu: '_menu_ records per page' }, bfilter: true, bsort: false , // setup responsive datatables helper. bautowidth: false, fnpredrawcallback: function () { // initialize responsive datatables helper once. if (!responsivehelper) { responsivehelper = new responsivedatatableshelper(tablecontainer, breakpointdefinition); } }, fnrowcallback: function (nrow, adata, idisplayindex, idisplayindexfull) { responsivehelper.createexpandicon(nrow); }, bdestroy: true, sajaxsource: "getdata", bdeferrender: true, aocolumns: [ @foreach (var item in model.gridallcolumnname) { <text> { "sname": "@item" }, </text> } ] , fnserverdata: function (ssource, aodata, fncallback, osettings) { if (osettings.aasorting.length) { aodata.push({ "name":"popupid" ,"value": "@model.popupid" }); } osettings.jqxhr = $.ajax({ "datatype": 'json', "contenttype": "application/json; charset=utf-8", "type": "get", "url": ssource, "data": aodata, "success": function (msg) { var json = jquery.parsejson(msg); fncallback(json); $('#' + datatableid ).removeclass('hidden'); } }); }, fncreatedrow: function( nrow, adata, idataindex ) { // bold grade 'a' grade browsers $(nrow).attr('onclick', 'getvalue("@model.gridgetvalue",this);'); } });
i think issue in function fnserverdata
causing ajax requests equal column in table.please take , help me out.
i found error area in next code :
@for (int = 0; < model.gridcolumnscount; i++) { if (!model.gridhidecolumns.contains(i)) { <text> tablecontainer.fnsetcolumnvis(parseint(@i), false ); </text> } }
my above code causing many requests.
jquery ajax jquery-datatables
Comments
Post a Comment