I want to implement chained store, whose source store placed in another ViewModel. And if I write as usual, chained store is empty, because View Model couldn't see store from another ViewModel this way.
sport_chained: {
source: 'sport' // sport is in another viewmodel
}
I found this solution:
// in ViewModel
constructor: function () {
this.callParent(arguments);
Ext.defer(function () {
this.setStores({
sport_chained: {
source: Ext.data.StoreManager.lookup('sport')
}
});
},10);
}
but it's not convinient, since then I have to place in constructor all another stores in this ViewModel. Maybe someone did something like this and knows how to do it in more convinient way? https://fiddle.sencha.com/#fiddle/otn
Maybe helpful for others who end up here. I was able to do this...but you have to think about it a little differently...
So, I have a viewModel on a parent component somewhere, and I want the child component to be able to chain a store to the parent...
ParentViewModel.js
ChildViewModel.js
ChildView.js
ParentView.js
Those are just brief snippets but hopefully it demonstrates the point on how to do chaining declaratively without having to force the issue through the controller. One other thing to note - I extended a gridpanel just so it was easy to illustrate binding the store.