PDA

View Full Version : Bug? Chained virtual stores not working



JoraRst
11 Jun 2017, 11:04 AM
I cannot find any documentation regarding this, but are Virtual Stores supposed to be chainable? If I try, an exception is raised:




ext-modern-all-debug.js:67533 Uncaught TypeError: source.addObserver is not a function
at constructor.updateSource (ext-modern-all-debug.js:67533)
at constructor.setter [as setSource] (ext-modern-all-debug.js:6980)
at Ext.Configurator.configure (ext-modern-all-debug.js:7479)
...



https://fiddle.sencha.com/#fiddle/218u&view/editor (https://fiddle.sencha.com/#fiddle/218u&view/editor)

evant
12 Jun 2017, 2:36 PM
Currently we don't support chaining for virtual stores, typically because they are driven by a particular UI and are a snapshot of the data.

Can you elaborate on your use case?

JoraRst
13 Jun 2017, 12:03 PM
The use-case for this lies in the architectural domain.

High level, a chained store is actually:



Filter inheritance down the line of stores.
A common set of records within the hierarchy.


From an architectural point of view this is a particularly fitting way of looking at it. At different levels of the application, limited (filtered) stores may be provided, which can be further refined at lower levels (e.g. at a fictional 'History' tab in the application, a store may be defined that filters the historical records, and in a sub-part of this application (e.g. MyHistory) this store may be chained to add a filter for only entries of the user. Other sub-parts may filter differently.

This way there is no code duplication at the different levels, and the data definitions match the application architecture.

Given the fact that the common set of record instances may be achieved using Session, a chained virtual store would primarily be an virtual store by itself that practically inherits the settings, incl. all filters down the hierarchy. This way the hierarchical nature of a chained store may be exploited to keep configuration at the level where it belongs best. Instance management of the records is controlled through Session, so no mix of concerns there.