Dec 16, 2015, 1:39 PM
Ext.Net MVC - Recycling models/stores across different views
In relation to my other thread about using (View-)Controllers for handling events in the views in a more structured approach I have a similar question related to stores.
We're using Ext.Net MVC and mostly define stores in the view. This works fine except that it seems impossible to re-use already defined stores. I have two views that use the exact same Store definition. The order in which these views are used is random so it is impossible to know whether or not a store definition has already been loaded and then reference it from the StoreManager (which I can't seem to find in the documentation) and there are cases where both stores are present on the same page. This gives a strange user experience: First, you unfold the first combo which does a server roundtrip and loads the contents and when you then select the second combobox it too will show a wait mask while retrieving the second set of results. This seems really unnecessary and silly and has already resulted in me being asked why that's happening.
I like how Ext.Net gives me the ability to directly map my .NET DTOs into ExtJs objects and I'd love to harnass that feature in such a way that I can define stores and load them during application start. In ExtJs I'd use the stores array in the Application class for this. In MVC there's the App() builder which has a Stores() method accepting a collection of AbstractStore objects or the StoreNames() method accepting an array of strings.
The first option appears only to be usable if I define ALL my stores in the same page as my call to the App() builder (which makes it an unmanageable heap of code). The second option seems only usable if I define my stores in Javascript, something I'd rather avoid since then I'd also have to define my models in Javascript.
Is there a way to have my cake and eat it too (ie, pre-load all my stores while still writing them in razor syntax)?
We're using Ext.Net MVC and mostly define stores in the view. This works fine except that it seems impossible to re-use already defined stores. I have two views that use the exact same Store definition. The order in which these views are used is random so it is impossible to know whether or not a store definition has already been loaded and then reference it from the StoreManager (which I can't seem to find in the documentation) and there are cases where both stores are present on the same page. This gives a strange user experience: First, you unfold the first combo which does a server roundtrip and loads the contents and when you then select the second combobox it too will show a wait mask while retrieving the second set of results. This seems really unnecessary and silly and has already resulted in me being asked why that's happening.
I like how Ext.Net gives me the ability to directly map my .NET DTOs into ExtJs objects and I'd love to harnass that feature in such a way that I can define stores and load them during application start. In ExtJs I'd use the stores array in the Application class for this. In MVC there's the App() builder which has a Stores() method accepting a collection of AbstractStore objects or the StoreNames() method accepting an array of strings.
The first option appears only to be usable if I define ALL my stores in the same page as my call to the App() builder (which makes it an unmanageable heap of code). The second option seems only usable if I define my stores in Javascript, something I'd rather avoid since then I'd also have to define my models in Javascript.
Is there a way to have my cake and eat it too (ie, pre-load all my stores while still writing them in razor syntax)?