EDIT- ANSWER FOUND
I realize why its not working. The 'filters' config field i was reading about was based on the Ext.data.AbstractStore class's config, not Rally's Rally.data.wsapi.Store config. Rally doesn't support the filter 'functions' becasue all Rally.data.wsapi.Store filters get turned into the wsapi query syntax (I read that in the SDK guide), which you cannot do with functions. That is why they only accept the Object[] argument, not Function[] argument.
So please correct me if I'm wrong, but i believe that the documentation for the wsapi Stores are wrong for the 'filters' config field.
I am trying to use a customized filter function to load Features from a list of User Stories. My issue is with understanding how filter functions work for the store Configuration. Right now i have:
_loadFeatures: function(cb){
var me = this;
Ext.create('Rally.data.wsapi.Store',{
model: 'PortfolioItem/Feature',
autoLoad:true,
start: 0,
pageSize: 20,
fetch: //stuff
context: //stuff
filters:[
function(feature){ return false; },
function(feature){
return feature.get('Release').Name == me.releaseRecord.get('Name');
},
function(feature){
var oid = feature.get('ObjectID');
var rs = me.StoryStore.getRecords();
for(var i = 0;i<rs.length;++i){
var r = rs[i];
if(r.get('Feature') && r.get('Feature').ObjectID == oid)
return true;
}
return false;
}
],
listeners: //stuff
});
},
There are a few things that are confusing me:
1) One of my functions returning false no matter what, which I believe should return NO results. Yet the store returns all of the Features, like there were no filters at all (it returns the first page of results, but the pages include all features)
2) can we tread the parameters in the filter functions as 'records' or the records' data, similar to record.data. What i mean is should I be using record.get('ObjectID') or record.ObjectID.
3) can I even use the 3rd filter function above, because it requires scoped variables, and the filtering is done server side. Are the scope variables preserved?.
I don't know the answers to these because i can't put console logs in the filter functions, as they are filtered server side.
You can still further filter the store on the client side after it has been loaded and remote filtered on the server:
http://help.rallydev.com/apps/2.0rc3/doc/#!/api/Ext.data.Store-method-filterBy