Artur Bodera (Joust)
17 Jul 2007, 2:44 AM
Hello folks!
Scenario:
1. Create a grid, with DS and CM.
2. GridView.init() is called, which calls GridView.bind() in line 96 (GridView.js)
3. bind() attaches to data store with ds.on(... , ... , this ) GridView scope
4. We destroy the grid with grid.destroy(true)
5. Ext.grid.Grid.destroy() calls GridView.destroy()
6. On line 1157 (GridView.js) bind function gets called again with: this.bind(null,null)
7. this.ds.un( ... , ... ) is called, but with no scope override;
8. Event.findListener(fn, null) --- no listener is found, because scope has changed, fn is not to be found and listener is NOT removed.
9. During next DS update (ie. reload) error is thrown (trying to update non-existent grid)
Fix:
Use the same scope override for un() as for on(), change lines 58-63 (GridView.js) or 26961-26966 (ext-all-debug.js):
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange);
this.ds.un("add", this.onAdd);
this.ds.un("remove", this.onRemove);
this.ds.un("update", this.onUpdate);
this.ds.un("clear", this.onClear);
change to:
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange,this);
this.ds.un("add", this.onAdd,this);
this.ds.un("remove", this.onRemove,this);
this.ds.un("update", this.onUpdate,this);
this.ds.un("clear", this.onClear,this);
Have a nice day.
Scenario:
1. Create a grid, with DS and CM.
2. GridView.init() is called, which calls GridView.bind() in line 96 (GridView.js)
3. bind() attaches to data store with ds.on(... , ... , this ) GridView scope
4. We destroy the grid with grid.destroy(true)
5. Ext.grid.Grid.destroy() calls GridView.destroy()
6. On line 1157 (GridView.js) bind function gets called again with: this.bind(null,null)
7. this.ds.un( ... , ... ) is called, but with no scope override;
8. Event.findListener(fn, null) --- no listener is found, because scope has changed, fn is not to be found and listener is NOT removed.
9. During next DS update (ie. reload) error is thrown (trying to update non-existent grid)
Fix:
Use the same scope override for un() as for on(), change lines 58-63 (GridView.js) or 26961-26966 (ext-all-debug.js):
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange);
this.ds.un("add", this.onAdd);
this.ds.un("remove", this.onRemove);
this.ds.un("update", this.onUpdate);
this.ds.un("clear", this.onClear);
change to:
this.ds.un("load", this.onLoad, this);
this.ds.un("datachanged", this.onDataChange,this);
this.ds.un("add", this.onAdd,this);
this.ds.un("remove", this.onRemove,this);
this.ds.un("update", this.onUpdate,this);
this.ds.un("clear", this.onClear,this);
Have a nice day.