将商店绑定到 extjs 5 中的列表过滤器
bind a store to a list filter in extjs 5
我在使用 sencha CMD 布局 (mvvm) 的网络应用程序上使用 extjs 5,并想绑定一个商店(用于标签)以在我的视图网格中过滤列表
viewModel 存储定义是:
stores: {
labelContacts: {
model: 'myapp.model.label.Contact'
, autoLoad: true
} // end contact store
} // end stores
和我在视图网格中的列表过滤器代码
filter: {
type: 'list',
bind: {store: '{labelContacts}'}
labelField: 'DisplayValue',
valueField: 'keyId'
}
过滤器有效,但它不显示绑定存储中的数据,而是从网格的存储中创建自己的数据
我是不是漏掉了什么?
在过滤器中传递这些 属性 并试试这个:
type: 'list',
store: store, // your store
labelField: 'DisplayValue', // Your displayValue
valueField: 'keyId', // Key Id on which you want to add filter
我找到了获得绑定商店的解决方法,但我对该解决方案不满意,因为它不是一个真正优雅的解决方案,很高兴听到任何建议
我的解决方案是将商店更改为:
filter: {
type: 'list',
store:new myapp.view.main.MainModel().getStore('labelContacts'),
labelField: 'label',
valueField: 'id'
}
另一种方法,对我有用
{
text: 'Yes/No',
dataIndex: 'accompanied',
filter: {
type: 'list',
},
listeners: {
boxready: function (_this, width, height, eOpts) {
_this.filter.store = _this.lookupViewModel().getStore('dicYesNo');
}
}
}
我在使用 sencha CMD 布局 (mvvm) 的网络应用程序上使用 extjs 5,并想绑定一个商店(用于标签)以在我的视图网格中过滤列表 viewModel 存储定义是:
stores: {
labelContacts: {
model: 'myapp.model.label.Contact'
, autoLoad: true
} // end contact store
} // end stores
和我在视图网格中的列表过滤器代码
filter: {
type: 'list',
bind: {store: '{labelContacts}'}
labelField: 'DisplayValue',
valueField: 'keyId'
}
过滤器有效,但它不显示绑定存储中的数据,而是从网格的存储中创建自己的数据
我是不是漏掉了什么?
在过滤器中传递这些 属性 并试试这个:
type: 'list',
store: store, // your store
labelField: 'DisplayValue', // Your displayValue
valueField: 'keyId', // Key Id on which you want to add filter
我找到了获得绑定商店的解决方法,但我对该解决方案不满意,因为它不是一个真正优雅的解决方案,很高兴听到任何建议 我的解决方案是将商店更改为:
filter: {
type: 'list',
store:new myapp.view.main.MainModel().getStore('labelContacts'),
labelField: 'label',
valueField: 'id'
}
另一种方法,对我有用
{
text: 'Yes/No',
dataIndex: 'accompanied',
filter: {
type: 'list',
},
listeners: {
boxready: function (_this, width, height, eOpts) {
_this.filter.store = _this.lookupViewModel().getStore('dicYesNo');
}
}
}