我试图在Sencha Touch框架下的组合框中进行过滤,但是我没有加载列表中的记录。
我的代码是:
onTemplatesFilterChoosen: function(field, newValue, oldValue){
var store = Ext.getStore('Customers'),
templatesStore = store.getAt(0).templates(), //get the associated store
text = field.getRecord().data.text;
templatesStore.clearFilter();
//here the code to filter main store based in records of the associated store
}
但它无法正常工作,我的store.getCount()
例如为0,显示空列表。
在我的主模型中,我添加了一个基于过滤器属性的新模型,名为"CustomerTemplateModel"
associations: [
{
type: 'hasMany',
associatedModel: 'x.customer.model.CustomerTemplateModel',
ownerModel: 'x.customer.model.CustomerModel',
associationKey: 'templates',
autoLoad: true,
filterProperty: 'value',
name: 'templates'
}
]
这里的模型相关:
Ext.define('x.customer.model.CustomerTemplateModel', {
extend: 'Ext.data.Model',
requires:[
],
config: {
useCache: false,
rootProperty: 'templates',
fields: [
{
name: 'text',
type: 'string'
},
{
name: 'value',
type: 'string'
}
]
}
});
我做错了什么?
提前谢谢。