javascript - jqgrid - beforeSearch and afterSearch function are not triggered -
i trying display progress bar when user tries filter data in jqgrid. but, beforesearch , aftersearch functions not triggered.
i tried follow documentation: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching but, not sure missing...
here fiddler: http://jsfiddle.net/14f3lpnk/1/
<table id="list"></table> <div id="pager"></div> var mydata = [ {id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"} , {id:"2",invdate:"2010-05-25",name:"test2",note:"note2",tax:"20.00",total:"320.00"}, {id:"3",invdate:"2007-09-01",name:"test3",note:"note3",tax:"30.00",total:"430.00"}, {id:"4",invdate:"2007-10-04",name:"blah",note:"stuff",tax:"10.00",total:"210.00"} ]; jquery("#list").jqgrid({ data: mydata, datatype: "local", height: 150, rownum: 10, ignorecase: true, rowlist: [10,20,30], colnames:['inv no','date', 'client', 'amount','tax','total','notes'], colmodel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'invdate',index:'invdate', width:90, sorttype:"date", formatter:"date"}, {name:'name',index:'name', width:100}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number"}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float"}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#pager", viewrecords: true, autowidth: true, height: 'auto', caption: "test grid", beforesearch: function () { alert('filter started'); }, aftersearch: function () { alert('filter complete'); } }).jqgrid('filtertoolbar', { stringresult: true, searchonenter: true, defaultsearch: "cn" }); any appreciated.
beforesearch , aftersearch callback functions of filtertoolbar method , not grid itself. should use there in following way
.jqgrid('filtertoolbar', { stringresult: true, searchonenter: true, defaultsearch: "cn", beforesearch: function () { alert('filter started'); }, aftersearch: function () { alert('filter complete'); } }); see modified demo http://jsfiddle.net/olegki/14f3lpnk/2/
Comments
Post a Comment