jquery - jQgrid's gridComplete event is firing but loadComplete is not firing..... why? -


in asp.net project integrating jqgrid show data. problem loadcomplete event not firing. entire jqgrid code follows:

function getdata(jqgridparams)      {         var sortcookieval = $.cookie("itemgridsortinfo");         var sname = "";         var sorder = "";         if (sortcookieval != null)          {             var sortinfo = sortinfofromcookie("itemgridsortinfo");             sname = sortinfo.sortname;             sorder = sortinfo.sortorder;         }         else          {             sname = "";             sorder = "asc";         }         var params = new object();         params.pageindex = jqgridparams.page;         params.pagesize = jqgridparams.rows;         params.sortindex = sname; //jqgridparams.sidx;           params.sortdirection = sorder;  //jqgridparams.sord;         params._search = jqgridparams._search;         if (jqgridparams.filters === undefined)             params.filters = null;         else             params.filters = jqgridparams.filters;          $.ajax({             url: 'wsajax.asmx/getdataforgrid',             type: "post",             contenttype: "application/json; charset=utf-8",             datatype: "json",             data: json.stringify(params),             success: function (data, textstatus)              {                 if (textstatus == "success")                  {                     var grid = $("#itemgrid")[0];                     grid.addjsondata(data.d);                 }             },             error: function (jqxhr, textstatus, errorthrown)              {                 alert(textstatus, errorthrown);             }         });     }      function savesortinfotocookie(name, grid)     {         var sortinfo = new object();         sortinfo.sortname = grid.jqgrid('getgridparam', 'sortname');         sortinfo.sortorder = grid.jqgrid('getgridparam', 'sortorder');         //$('#hidden').val(json.stringify(gridinfo));         //alert($('#hidden').val());         $.cookie(name, json.stringify(sortinfo), {expires: 5});     }      function sortinfofromcookie(name)      {         var c = $.cookie(name);         if (c === null)             return;         return $.parsejson(c);     }      $(document).ready(function () {         var oitemgrid = $("#itemgrid");         oitemgrid.jqgrid({             datatype:                 function (jqgridparams) {                     getdata(jqgridparams);                 },             colnames: ['type', 'name', 'desc'],             colmodel: [                 { name: 'type', index: 'type', width: 40 },                 { name: 'name', index: 'name', width: 40 },                 { name: 'desc', index: 'desc', width: 40, sortable: false}],             autowidth: true,             height: 'auto',             rownum: 10,             rowlist: [10, 20, 30, 40],             viewrecords: true,             gridview: true,             autoencode: true,             ignorecase: true,             caption: 'remember sorting , filtering functionality',             pager: '#igpager',             onsortcol: function (colmodel, colname, sortorder) {                 savesortinfotocookie("itemgridsortinfo", $("#itemgrid"));                 var storeval = $.cookie("itemgridsortinfo");                 alert("saving sort info in cookie: " + storeval);             },             gridcomplete: function () {                 var prvdata = $.cookie("itemgridsortinfo");                 alert("reading saved sort info cookie : " + prvdata);                  var pageno = $.cookie("itemgridpageinfo");                 alert("reading saved page no. cookie:" + pageno);             },             loadcomplete: function (data) {                 if(data != null)                 {                     alert("inside loadcomplete..");                 }             },             //loadonce: true         }).jqgrid('navgrid', '#igpager', { edit: false, add: false, del: false }, {}, {}, {}, {}, {});     }); 

and if possible please tell me difference between gridcomplete , loadcomplete according scenario....

the problem set datatype function (custom defined function retrieving data) instead of local. if use function, should call loadcomplete in own implementation.

so if change other type local, loadcomplete handled automatically jqgrid. created demo you.

demo


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -