-
17 Aug 2012 1:55 AM #11
Hi Animal,
thanks for the fix.
While the selection now visually remains, when you add an event listener:
grid.getSelectionModel().on("selectionchange",function(aSelectionModel,aSelectedEntries){
It still gets called with aSelectedEntries=[] when scrolling down, while the selection remains visible in the grid when srolling up again.
-
17 Aug 2012 2:23 AM #12
The patch is not perfect. The thing is, the record does get unselected when it gets scrolled out of the store, and reselected when it re-enters the store.
The selection classes do not play well with the concept of persistently selected records which cycle back in as a different instance later.
It will need fixing. Hopefully the patch above will work for now while this bug is addressed.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
17 Aug 2012 3:43 AM #13
I've fixed this issue by extending RowModel.
Code:Ext.define('Ext.ux.es.RowModelWithMemory', { extend: 'Ext.selection.RowModel', alias: 'selection.rowmodelwithmemory', selected_row_ids: new Ext.util.HashMap(), constructor: function() { Ext.ux.es.RowModelWithMemory.superclass.constructor.apply(this, arguments); this.on('select', function(me, record, rowIdx){ me.selected_row_ids.add(record.getId(), true); return true; }); this.on('deselect', function(me, record, rowIdx){ me.selected_row_ids.removeAtKey(record.getId(), true); return true; }); }, refresh: function() { var me = this; Ext.ux.es.RowModelWithMemory.superclass.refresh.call(me); var keys = me.selected_row_ids.getKeys(); var store = me.store; var toBeSelected = []; for(var i = 0;i<keys.length;i++) { var record = store.getById(me.selected_row_ids.get(keys[i])); if (record && !me.isSelected(record)) { toBeSelected.push(record); } } if (toBeSelected.length) { // perform the selection again me.doSelect(toBeSelected, false, true); } } });
-
17 Aug 2012 10:42 AM #14
urban novak - nice solution! When you select items, scroll away, and then scroll back the selected items hold nicely.
Unfortunately this solution does not cover all cases yet. There are errors when shift selecting items across page loads.
how to reproduce:
-select 1 item
-scroll away
-shift select to select all items
We end up trying to add an undefined record when multiSelecting resulting in a "TypeError: o is undefined" error. I think this portion of the problem will not be trivial (but you are welcome to prove me wrong).
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7013
in
4.1.


Reply With Quote