【发布时间】:2015-06-18 10:22:11
【问题描述】:
我想实现链式存储,其源存储放置在另一个 ViewModel 中。如果我像往常一样写,chained store 是空的,因为 View Model 无法通过这种方式从另一个 ViewModel 看到 store。
sport_chained: {
source: 'sport' // sport is in another viewmodel
}
我找到了这个解决方案:
// in ViewModel
constructor: function () {
this.callParent(arguments);
Ext.defer(function () {
this.setStores({
sport_chained: {
source: Ext.data.StoreManager.lookup('sport')
}
});
},10);
}
但这并不方便,从那时起我必须将这个 ViewModel 中的所有其他商店都放在构造函数中。也许有人做了这样的事情并且知道如何以更方便的方式做到这一点? https://fiddle.sencha.com/#fiddle/otn
【问题讨论】: