jqgrid - jGrid search doesn't work properly when match rule is 'any' and first query has dataUrl -
scenario:
use "stype:'select'" 'client' column in search popup.
the dataurl column returns "<select><option value='f'>f</option><option value='o'>o</option></select>"
bring search popup.
first line of search criteria: 'client not equal f'
second line of search criteria: 'amount not equal 300'
match type: 'any'
click on find.
i expect both records client type == 'f' show neither do. looks match type still 'and' instead of 'or'.
$(function() { var mydata = [ {id:"1", name:"test", amount:"200"}, {id:"2", name:"test2", amount:"300"}, {id:"3", name:"f", amount:"400"}, {id:"4", name:"test4", amount:"200"}, {id:"5", name:"test5", amount:"300"}, {id:"6", name:"test6", amount:"400"}, {id:"7", name:"test7", amount:"200"}, {id:"8", name:"test8", amount:"300"}, {id:"9", name:"test9", amount:"400"}, {id:"10",name:"test10", amount:"500"}, {id:"11",name:"f", amount:"500"}, {id:"12",name:"test11", amount:"500"}, {id:"13", name:"test", amount:"200"}, {id:"14", name:"o", amount:"200"} ]; jquery("#list").jqgrid({ datatype: "local", data: mydata, width: 700, colnames:['inv no','client', 'amount'], colmodel:[ {name:'id',index:'id', width:65, sorttype:'int', searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}}, {name:'name',index:'name', width:100, searchoptions:{dataurl:'/api/domains/producttypedomain'}}, {name:'amount',index:'amount', sorttype:'int', width:80, align:"right"} ], rownum:100, pager: '#pager', height:'auto', viewrecords: true, rownumbers: true, gridview : true, caption:"advanced search example" }); jquery("#list").jqgrid('navgrid','#pager', { edit:false,add:false,del:false,search:true,refresh:true }, {}, // edit options {}, // add options {}, //del options {multiplesearch:true, overlay:false, recreatefilter:true} // search options ); });
i verified example , see found bug in jqgrid. +1 me you.
by way same bug still exist in new version of new multisearch plugin in alpha phase (see here more information). bug can reproduced if 1 try make or (any) operation of 2 "not equal" operation. "not equal" implementation has bug.
in current version (with bug) of jqgrid searching/filtering follows execution of statements like
!(parseint(this.amount,10) == parseint(200,10)) && !(parseint(this.amount,10) == parseint(500,10))
in case of operation ((amount<>200)||(amount<>500))
. wrong. "not equal" implementation buggy in current version of jqgrid.
i fixed problem in source code of jqgrid following:
1) added new function notequals
defined
this.notequals=function(f,v,t){ return self._comparevalues(self.equals,f,v,"!==",t); };
and inserted after this.equals
(see here).
2) modified line 1359 of grid.base.js from
'ne':function(queryobj) {return queryobj.not().equals;},
to
'ne':function(queryobj) {return queryobj.notequals;},
after fixes searching works correct. can see results here (your original version 1 can test here)
in next time post suggestion in the trirand forum , hope tony tomov (the developer of jqgrid) implement fixes in jqgrid.
updated: how promised posted the bug report suggestions fix problem.
updated 2: bug fixed in current developer version on github. can see results here use new fixed version more changes suggested in answer. new multiselect interface can see here.
Comments
Post a Comment