View Full Version : Get store's grid
Hi all,
Is it possible somehow to get grid from it's store?
I need to clear selections after records are edited.
So I need
record.store.(get grid).getSelectionModel().clearSelections()
Thanks!
laurentParis
13 Sep 2010, 4:27 AM
If you have an ID for your grid, use Ext.getCmp but,if not,
Use event afteredit on Ext.grid.EditorGridPanel (grid)
grid.on('afteredit', afterEdit, grid ); //scope is grid
function afterEdit(e) {
this.getSelectionModel().clearSelections();
};
thank you for your reply!
It's no problem to get the grid, I can pass it to my function as an additional parameter together with selected records. But I'm lookig for how to use records to find out what grid they are belong to :).
Animal
13 Sep 2010, 5:00 AM
They don't belong to a grid. A store is independent from any UI. There's no linkage from a Store to any UI object.
Indeed you could have several UI objects using one Store. I do this in several projects which need different "views" of data just like Window's explorer's different views of your files.
If you have an ID for your grid, use Ext.getCmp but,if not,
Use event afteredit on Ext.grid.EditorGridPanel (grid)
grid.on('afteredit', afterEdit, grid ); //scope is grid
function afterEdit(e) {
this.getSelectionModel().clearSelections();
};
I would not advocate the use of Ext.getCmp
They don't belong to a grid. A store is independent from any UI. There's no linkage from a Store to any UI object.
Indeed you could have several UI objects using one Store. I do this in several projects which need different "views" of data just like Window's explorer's different views of your files.
Animal,
I know that. I'll try to ask in different way: How can I find which UI objects use this store? The store somehow "tells" grid to update after:
record.data.field = 'abc';record.commit();
it does that via event handlers, not direct references.
Jay,
So the store doesn't know who uses it's data right?
correct. It publishes various events (such as loaded) to alert any subscribers to update their view. Look at DataView.js and GridView.js and it will make sense.
Powered by vBulletin® Version 4.2.3 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.