我的目标是在我的jqGrid上进行动态过滤。表达式如下:(A OR B)AND(C OR D或E)和...... 所以,我创建了一个全局过滤器,带有“AND”子句和带有“OR”的子组。
代码:
var globalFilter = { groupOp: "AND", rules: [], groups: []};
var filter1 = { groupOp: "OR", rules: []};
<#list listFilter1 as filter1>
filter1.rules.push({field:"filterName1",op:"eq",data:filter1.name});
</#list>
var filter2 = { groupOp: "OR", rules: []};
<#list listFilter2 as filter2>
filter2.rules.push({field:"filterName2",op:"eq",data:filter2.name});
</#list>
var filter3 = { groupOp: "OR", rules: []};
<#list listFilter3 as filter3>
filter3.rules.push({field:"filterName3",op:"eq",data:filter3.name});
</#list>
globalFilter.groups.push(filter1);
globalFilter.groups.push(filter2);
globalFilter.groups.push(filter3);
最后,当我有一个像“A AND B”这样的子句时,它运行良好,但是当子组有多个规则时它不会。我的印象是所有条件之间存在OR。怎么解释呢?
先谢谢你的帮助,