mardi 1 juillet 2014

Data grid of one store fires request to dynamically load a data grid of another store

I'm looking for a "How-To" Example of two data grids each with their own model & store. The catch is when the user clicks on a row in, let's say dataGrid1. An event is fired to load the store of dataGrid2 based on what the user selected in dataGrid1.

ie. dataGrid1 is a list of customers which is an autoloaded store. Then there is a dataGrid2 which is a list of customer orders. So our user clicks on a customer name in dataGrid1 and that fires off an event to the store of dataGrid2 (which is empty at the moment). That event tells the dataGrid2 store to only load the orders for that customer. When a user clicks on another customer in dataGrid1 the dataGrid2 store clears and reloads with that new customer orders.


I know I can use other things to make this behavior happen (ei. the Cars example in the getting started), but I'd like to have it all contained in data grids and stores. Filtering the second store doesn't buy me what I really want and that's cacheing only the data I really want to use and not the whole database table.

I'm using Architect so I'd like to keep things MVC.


Thanks!





Aucun commentaire:

Enregistrer un commentaire