PDA

View Full Version : Same store, different datasets displayed in chart and grid



winkelmann
20 Mar 2012, 12:56 PM
Hey there,

I was wondering if there is a way to have a store with a large dataset bound to a grid, but show only a subset of it in a chart without having to clone my store?

Thank you all in advance,
Jan

vietits
20 Mar 2012, 3:42 PM
Have a try with <store>.filter() . However, you can only show one chart at a time. If not all the charts will be shown with the same data.

mitchellsimoens
21 Mar 2012, 10:00 AM
If the dataset is changed in a store it will reflect in all widgets bound to it. There is no built-in way to separate datasets for different widgets. Sure you can extend Store and figure some way to have the widgets look at two different datasets (I would keep the actual dataset along and each widget get it's own dataset)... just would be a little tricky

winkelmann
21 Mar 2012, 10:00 AM
Thank you for the reply ;) Since I have a pretty fixed set of data here anyway I guess I'll just have two stores. Making a custom store with different data views is just not worth the effort in this case. Would have been great if it was built-in somehow.

mitchellsimoens
21 Mar 2012, 10:09 AM
Thank you for the reply ;) Since I have a pretty fixed set of data here anyway I guess I'll just have two stores. Making a custom store with different data views is just not worth the effort in this case. Would have been great if it was built-in somehow.

There's just too many use cases to have something like this built-in. I have seen some people have a "master" store that splits off "child" stores and syncs them when data on the master store changes. The "master" store becomes more of a manager and widgets then register with that "master" store, that register method returns a newly created "child" store. The "child" stores are kept internal to the "master" store and then looped through to keep in sync.