我在WSAPI查询中传递了一个函数作为筛选器,但是它似乎对返回的结果没有影响。是否存在无法使用此方法过滤的字段?
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Ext.create('Rally.data.WsapiDataStore', {
model : 'TestCase',
fetch : ['TestCases'],
filters : [
function(item) {
return item.FormattedID.indexOf('10') !== -1;
}
]
}).load({
callback: function(records) {
//All records returned, no filter applied
}
});
}
});发布于 2013-08-23 07:31:13
我也希望您的代码能够工作,但可能在应用客户端筛选器之前发生了回调。以下是代码的修改版本,其中应用了筛选器,并且如预期那样只返回了一条记录:
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
var myStore = Ext.create('Rally.data.WsapiDataStore', {
model : 'TestCase',
fetch : ['FormattedID']
});
myStore.load({
callback: function(records) {
myStore.filterBy(function(item) {
return item.get('FormattedID').indexOf('10') !== -1;
});
console.log(myStore.getRange()); //one record
}
});
}
});https://stackoverflow.com/questions/18386673
复制相似问题