jquery - How to reload jqxGrid data with new data from another url -
jquery - How to reload jqxGrid data with new data from another url -
i have jqxgrid form jqwidgets library , have bound info jqxgrid so..
var url = "getconsignments.php?type="+$('#selectisdelevered').val(); var consignmentsource = { datafields: [ { name: 'consignmentid', type: 'string' } ,{ name: 'name' , type: 'string' } ], id: 'consignmentid', datatype: "json", async: false, cache:false, url: url , filter: function() { // update grid , send request server. $("#jqxgrid").jqxgrid('updatebounddata', 'filter'); }, sort: function() { // update grid , send request server. $("#jqxgrid").jqxgrid('updatebounddata', 'sort'); }, root: 'rows', cache: false, beforeprocessing: function(data) { if (data != null) { consignmentsource.totalrecords = data[0].totalrows; } } }
this initionalizing , server call. bellow code binding info server
consignmentadapter = new $.jqx.dataadapter(consignmentsource); $("#jqxgrid").jqxgrid( { source: consignmentadapter, theme:'bootstrap', columnsresize:true, width: '100%', filterable:true, autoheight:true, rowdetails: true, autorowheight :true, showfilterrow: true, pageable:true, sortable: true, virtualmode: true, rendergridrows: function() { homecoming consignmentadapter.records; }, ready: function () { // $("#jqxgrid").jqxgrid('showrowdetails', 1); } , columns: [ { text: 'id', width: '10%',datafield: 'consignmentid'} , { text: 'name', datafield: 'name', width: '18%' } ] } );
the selectisdelevered
select
tag has 3 options , every alternative loads different data, wand rebind , reload , or refresh grid ('#selectisdelevered').change()
function have tested $('#jqxgrid').jqxgrid('updatebounddata');
didn't work , have tried $('#jqxgrid').jqxgrid('refresh');
repeating binding steps . took me 3 days , suggestion ?!!
you can alter url straight next code:
('#selectisdelevered').change({ var tmps = $("#jqxgrid").jqxgrid('source'); tmps._source.url = "getconsignments.php?type="+$('#selectisdelevered').val(); $("#jqxgrid").jqxgrid('source', tmps); });
jquery ajax jqxgrid
Comments
Post a Comment