javascript - callback to set postdata without having to reload grid? -


does (free-) jqgrid provide callback-function can set postdata before grid loaded?

in case it's pseudo postdata since using jqgrid loadonce : true. using postdata apply filters grid. load data ajax call.

i want load grid data @ once server - locally apply filters. when user changes filters (for example using toolbar-searching/filtering) gets applied local data.

i have tried:

beforeinitgrid : function() {     $("#grid").jqgrid('setgridparam', {         search:     true,         postdata : {"toolbar":[{"name":"customer","value":"difranco"}],"postdata":{"_search":"true","nd":"1461054190117","rows":"30","page":"1","sidx":"my_date","sord":"asc","totalrows":"10000","filters":"{\"groupop\":\"and\",\"rules\":[{\"field\":\"customer\",\"op\":\"cn\",\"data\":\"difranco\"}]}"},"sortname":"my_date","sortorder":"asc","page":"1","rownum":"30"}     }); } 

also callback functions: gridcomplete, loadcomplete; , tried set postdata parameter directly jqgrid.

but without reloading .trigger("reloadgrid") neither did work.

thanks help!

it seems me can use parameters during creating grid:

loadonce: true, forceclientsorting: true, search: true, postdata: {    filters: {        groupop: "and",        rules: [            {field: "customer", op: "cn", data: "difranco"}        ]    } } 

you need no tricks gridcomplete, loadcomplete , .trigger("reloadgrid"). see the demo or this one, included in the readme free jqgrid 4.13.1. demos use local data, same works remote data. see little more sophisticated demos here , here, demonstrate powerful features: additionalproperties , custom sorting using sortfunc, uses loadonce: true, forceclientsorting: true , postdata.filters search: true.

it's important server should ignore parameters send jqgrid , return data. free jqgrid filter data returned server based on postdata.filters, sort result , display first page of final results user. user can use local paging, can modify filter , on. no additional requirements server exist.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -