PDA

View Full Version : Grid unbindStore



zerba78
3 Oct 2014, 12:02 AM
Hi all
I'm not able to unbind a grid from its store. I will appreciate any help.
I'm using ExtJS 4.2.1.
I have a grid with its store, but the same store is shared with other widgets. I want to modify the content of the store (through the other widgets) but the grid should not update its content (i.e. it should not listen to any event the store fires).
I know this problem could be solved by cloning the store, but I'd prefer not to clone it.
After looking at the source code, I tried with


store.un('load', function () {this.unbindStore();}, this, {single: true});

where "this" is the grid, because (of course) I need to load the store and then to unbind the grid.
This does not work, i.e. I delete records from the store and the grid gets updated (that is what I want to avoid).
Any idea?
Thanks in advance

watertrac_dev
3 Oct 2014, 8:33 AM
What other widgets are working with the store instance?

zerba78
6 Oct 2014, 12:53 AM
Hi
this is not a fixed layout but a dynamic one; there could be other grids bound to the same store and permitting user-interactions. For example: consider 2 grids: the first one showing only some information cominig with the store and it should be fixed (unbound from the store) but the other one should instead permit the user to manipulate data contained in the store.
The widget to be unbound form the store, apart from the grid (on which now I'm investigating), could be also a chart, and unfortunately I discovered that the chart widget doesn't have the unbindStore method at all; is there any equivalent method?
Thanks and best regards
Davide

watertrac_dev
6 Oct 2014, 5:46 AM
How about something like the following?

bc6

zerba78
8 Oct 2014, 7:45 AM
Hi Brian
your code works nicely, many thanks, but it causes some (unwanted) side-effects: mouse over and cellclick event don't work anymore.
I will try to find a way to solve those problems.
But, according to you, if I solve the grid.unbindStore problem, do I will encounter the same side effects?
Thanks and best regards
Davide

watertrac_dev
8 Oct 2014, 7:48 AM
Aside from cloning the store, I'm not sure that there's an easy way to create a read-only "view" of the store that doesn't update when store records are updated. If I come across a solution I will post an update to this thread.

zerba78
9 Oct 2014, 12:37 AM
very kind of you
Thanks
Davide