我想使用结合OR和AND运算符的过滤器,但此过滤器语法仅使用AND运算符:
this.grid = this.add({
xtype: 'rallygrid',
model: model,
columnCfgs: [
'FormattedID',
'Name',
'Priority',
'State'
],
storeConfig: {
filters: [
{
property: 'Priority',
operator: '=',
value: 'High Attention'
},
{
property: 'Priority',
operator: '=',
value: 'Normal'
},
{
property: 'State',
operator: '=',
value: 'Open'
}
]
}
});
答案 0 :(得分:1)
如果过滤器必须使用AND和OR运算符的混合,则需要使用和/或Rally.data.QueryFilter方法构建它。 以下是我在“打开”状态下过滤“高注意”或“正常”优先级缺陷的完整示例:
Rally.onReady(function () {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Rally.data.ModelFactory.getModel({
type: 'Defect',
success: function(model) {
var filter = Ext.create('Rally.data.QueryFilter', {
property: 'Priority',
operator: '=',
value: 'Normal'
});
filter = filter.or({
property: 'Priority',
operator: '=',
value: 'High Attention'
});
filter = filter.and({
property: 'State',
operator: '=',
value: 'Open'
});
filter.toString();
this.grid = this.add({
xtype: 'rallygrid',
model: model,
columnCfgs: [
'FormattedID',
'Name',
'Priority',
'State'
],
storeConfig: {
filters : [filter]
}
});
},
scope: this
});
}
});
Rally.launchApp('CustomApp', {
name:"MyApp"
});
});