Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rally App SDK 2.0: Cannot modify QueryFilter object after initial creation

I am trying to dynamically create filters for a rallycardboard by using a QueryFilter object. I first create an array of QueryFilter that contains filtering on one property/value pair. I then check some other fields for values in order to decide whether to add those properties to the QueryFilter. However, it seems that after creation, even though I am able to access the object, it refuses to be appended to.

Here is an example of how it's structured:

var filters = [Ext.create('Rally.data.QueryFilter', {
    property: 'attr1',
    operator: '=',
    value: this.attr1
})];

if (this.attr2 !== "") {
    filters[0].and(Ext.create('Rally.data.QueryFilter', {
        property: 'attr2',
        operator: '=',
        value: this.attr2
    }));
}

if (this.attr3 !== "") {
    filters[0].or(Ext.create('Rally.data.QueryFilter', {
        property: 'attr3',
        operator: '=',
        value: this.attr3
    }));
}
like image 608
user1417835 Avatar asked Apr 11 '26 03:04

user1417835


1 Answers

It looks like the object returned has to be reassigned inside of an array, like such:

var filters = [Ext.create('Rally.data.QueryFilter', {
    property: 'attr1',
    operator: '=',
    value: this.attr1
})];

if (this.attr2 !== "") {
    filters = [filters[0].and(Ext.create('Rally.data.QueryFilter', {
        property: 'attr2',
        operator: '=',
        value: this.attr2
    }))];
}

if (this.attr3 !== "") {
    filters = [filters[0].or(Ext.create('Rally.data.QueryFilter', {
        property: 'attr3',
        operator: '=',
        value: this.attr3
    }))];
}
like image 117
user1417835 Avatar answered Apr 13 '26 04:04

user1417835