jquery - Free jqGrid - callback functions on filterToolbar are not being called -


example @ jfiddle (look text "example filter callback function")

this deceleration seems have no effect on beforeclear & beforesearch:

$(nameofgrid).jqgrid('filtertoolbar', {stringresult: true, searchonenter: true, searchoperators: true, defaultsearch : "cn",beforeclear: function() {alert(1)}, beforesearch: function() {alert(1);}}); 

i placed "alert(1)" see if popsup, doesn't seems triggered when filter or clean filter.

i see since 4.9.0, on latest example shows.

appreciate help,

thanks,

tal.

the reason of problem: usage of filtertoolbar more once:

$('#jqgrid').jqgrid('filtertoolbar', {stringresult: true}); $('#jqgrid').jqgrid('navgrid',{...}); $('#jqgrid').jqgrid('filtertoolbar', {stringresult: true, searchonenter: true, searchoperators: true, defaultsearch : "cn",beforeclear: function() {alert(1)}, beforesearch: function() {alert(1);}}); 

if 1 comments first call of filtertoolbar 1 working demo: http://jsfiddle.net/olegki/13582dh7/4/

if need recreate filter should first call destroyfiltertoolbar before calling filtertoolbar next time.

i additionally recommend clean code make shorter , better readable. can example remove unneeded <div id="jqgridpager"></div>, replace pager: "#jqgridpager" pager: true , remove "#jqgridpager" parameter calls of navgrid , navbuttonadd.

you should consider move searching options of navgrid , filtertoolbar in searching parameter of jqgrid.

even more important remove hidden column colmodel, don't plan display user , use additionalpropertries instead. it's strictly recommended use column templates in colmodel.

after reducing code , making more readable , will never spend time such problems calling of filtertoolbar twice different parameters.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -