Reputation: 161
Using the 2.0p4 JavaScript SDK, I am trying to recreate a grid app I created previously using 1.30 JavaScript SDK, and am having problems creating a complex filter (with multiple ANDs and ORs).
Here is the query from the 1.30 version:
function itemQuery() {
var queryObject = {
key: 'defect',
type: 'defect',
fetch: 'FormattedID,Name,State,ScheduleState,SupportNumber,OpenedDate,Priority,Rank,Severity,SubmittedBy,Owner,Iteration,Release,Project',
query: '(((((SupportNumber contains "RNT") OR (SupportNumber contains "NS")) OR (SupportNumber contains ":")) OR (SupportNumber contains "CASE")) AND (State != Closed))',
project: null
};
So I querying for items that contains "RNT", ":", "NS", or "CASE" AND are not closed. (SupportNumber is a custom field, which people have entered data in differently at different points)
And here is my App.js from the new version I am trying to create:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Rally.data.ModelFactory.getModel({
type: 'Defect',
context: {
workspace: 'workspace/12345',
project: null,
},
success: function(model) {
this.grid = this.add({
xtype: 'rallygrid',
model: model,
columnCfgs: [
'FormattedID',
'Name',
'SupportNumber',
'Priority',
'Severity',
'State',
'Iteration',
'Release',
'Project',
'Owner',
'SubmittedBy'
],
storeConfig: {
filters: [
{
property: 'State',
operator: '!=',
value: 'Closed'
},
{
property: 'SupportNumber',
operator: 'contains',
value: 'RNT'
}
]
}
});
},
scope: this
});
}
});
I can see that just by adding filters to the config, you create ANDs, however I am lost in the documentation with how to create ANDs and ORs filters in the same config.....
Any direction anyone can give on how to create filter configs for App SDK 2.0, that use multiple ANDs and ORs, would be greatly appreciated.
Upvotes: 1
Views: 1166
Reputation:
Check out:
Along with this Stackoverflow Answer:
Rally App SDK 2.0: Cannot modify QueryFilter object after initial creation
Which shows a nice example of using Rally.data.QueryFilter to prepare an array of filters representing multiple conditions.
Upvotes: 1