具有多个条件的ag-grid gridApi.setFilterModel()模型[angular6] [英] ag-grid gridApi.setFilterModel() model with multiple conditions [angular6]
问题描述
我想基于一组规则来过滤我的表。我发现通过过滤器模型和条件可以做到这一点。我尝试叠加条件,但似乎不起作用。例如
I want to filter my table based on a set of rules. I found that this was possible to do via filtermodels and conditions. I tried to stack conditions but that doesn't seem to work. e.g.
这有效
Filter = {
columnName: {
condition1 : {
type: 'contains',
filter: 'searchstring1',
},
operator: 'AND',
condition2 : {
type: 'contains',
filter: 'searchstring2',
},
},
};
这不起作用。
Filter = {
columnName: {
condition1 : {
condition1 : {
type: 'contains',
filter: 'searchstring1',
},
operator: 'AND',
condition2 : {
type: 'contains',
filter: 'searchstring2',
},
},
operator: 'OR',
condition2: {
type: 'contains',
filter: 'searchstring3
}
}
};
对我要达到的目标有任何建议或解决方法吗?我有兴趣堆叠它们,以便可以有4种条件。1。
Any suggestions or work arounds for what I'm trying to acheive? I'm interested in stacking them so that I can have like perhaps 4 conditions1.
推荐答案
检查后,我遇到了同样的问题我发现ag-grid来源目前无法实现- condition1
和 condition2
是硬编码的。
I have the same problem, after inspecting the ag-grid sources I have found that this is not currently possible - the condition1
and condition2
are hardcoded.
我的解决方法是创建布尔类型的隐藏列,其中包含这些多个条件的结果,并在后端计算值,并且对其进行过滤。
My workaround is to create a hidden column of boolean type containing the result of these multiple conditions with value computed on the back-end side and filter on it.
这篇关于具有多个条件的ag-grid gridApi.setFilterModel()模型[angular6]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!