Vivek
Vivek

Reputation: 13238

How to clone extjs store and use it for multiple grids

How can i use same store(with different filters) for multiple grids having same column structure?

I have used store.filter() method and passed the filtered store to the grid but since only the reference of filtered store is getting passed, all grids are showing same data.

Tried Ext.clone() with no luck

Upvotes: 2

Views: 4855

Answers (2)

Sven Tore
Sven Tore

Reputation: 987

This is one of the problems that the framework really haven't solved in ExtJs 4.x But they have specific support for it in ExtJs 5. If possible you may want to consider upgrading.

If not, you could request the data from the server by ajax, and then use json result to fill data to all the stores. Using this method you can will several stores, with the same data, with only a single server request.

Upvotes: 2

Saki
Saki

Reputation: 5856

The best approach is to create separate instances of the same store class in grid initComponent override - no need for clones then.

You can see this approach here

Upvotes: 1

Related Questions