javascript - Append Data to jqGrid -
i'd append data jqgrid when user hits see more button, loads additional data retrieved via json request.
html
<div id="seemoresearchresultsdiv" class="scroll" style="text-align: center;"> <div id="ancsearchresultsseemore" class="graybutton" style="float: left; left: 350px;"> <ul> <li class="ltimg"></li> <li><a href="#" onclick="seemorefunction()">see more</a></li> <li class="rtimg"></li> </ul> </div> </div> here's grid
jquery("#searchresultdatagrid").jqgrid({ url: updatedurl, datatype: "json", ajaxgridoptions: { contenttype: "application/json" }, jsonreader: { id: "ctsid", cell: "", root: function (obj) { return obj.results; }, page: function () { return 1; }, total: function (obj) { return obj.count; }, records: function (obj) { return obj.length; }, repeatitems: false }, colnames: ['cts id', 'name', 'city', 'type', 'status', 'platinum id', 'rsm group code'], colmodel: [{ name: 'ctsid', index: 'ctsid', width: 40, align: "center" },{ name: 'customername', index: 'customername', width: 150, align: "center" }, { name: 'cityandstate', index: 'cityandstate', width: 90, align: "center" }, { name: 'customertypename', index: 'customertypename', width: 50, align: "center" }, { name: 'customerstatusname', index: 'customerstatusname', width: 50, align: "center" }, { name: 'platinumid', index: 'platinumid', width: 50, align: "center" },{ name: 'rsmgroupcode', index: 'rsmgroupcode', width: 100, align: "center" }], pager: false, rownum: -1, // rowlist:[25,50,75,100], sortorder: "asc", autowidth: true, viewrecords: true, shrinktofit: true, rownumbers: false, cleargridridata: false, gridview: true, caption: false}); and here's how i'm calling it
function seemorefunction() { page = page + 1; updatedurl = updatesearchstring(" "); refreshgrid(); } function refreshgrid() { $('#searchresultdatagrid').setgridparam({ url: null }); $('#searchresultdatagrid').setgridparam({ url: updatedurl }); $('#searchresultdatagrid').trigger('reloadgrid'); } i verified json requests , correct problem i'm not able append existing data. i've disabled cleargriddata.
any appreciated.
Comments
Post a Comment