-
26 Jul 2012 5:56 AM #1
Selection disappears when scolling in an infinite grid
Selection disappears when scolling in an infinite grid
Hi,
I have discovered a problem when using selections and the infinite grid mode.
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.1 Build date: 2012-07-04 21:23:42
- Google Chrome 20.0.1132.57 m
- When activating infinite scrolling and selecting a row by mouse click the selection disappears when you scroll the selection far out of the visible area.
- Use infinite scrolling (buffered: true, pageSize: 100) and select a row. When you scroll down and up again the selection isremoved. If you add a selectionchange listener you see that the selection is actually removed from the Selection Model.
- The selection should not be removed from the Selection Model when scrolling down and should be visible when scrolling back to the selected row again.
- The selection is removed and no longer shown.
-
26 Jul 2012 10:38 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,117
- Vote Rating
- 453
Have you tried setting pruneRemoved to false on the selection model?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Jul 2012 12:04 AM #3
Hi,
I am not so sure how to do this. I tried:
but there is no such method on my SelectionModel. I can not see a property named "pruneRemoved" in the debugger, either.grid.getSelectionModel().setPruneRemoved(false)
However
works (of course) but has no effect.grid.getSelectionModel().pruneRemoved=false
I found a code snippet that sets the pruneRemoved property when contructing the grid, but the following also seems to have no effect:
Code:var grid = Ext.create('Ext.grid.Panel', { plugins: [cellEditor], width: 100, height: 100, store: store, autoScroll:true, columns:config.columns, renderTo: Ext.get(config.id), selModel: { pruneRemoved: true } });
-
27 Jul 2012 4:07 AM #4
Try it like this:
pruneRemoved: false
Code:var grid = Ext.create('Ext.grid.Panel', { plugins: [cellEditor], width: 100, height: 100, store: store, autoScroll:true, columns:config.columns, renderTo: Ext.get(config.id), selModel: { pruneRemoved: true } });
-
27 Jul 2012 4:26 AM #5
Hi, you are correct: I copied the wrong state of my JavaScript file. But of course I also tried with pruneRemoved:false .
I just tried "true" to see if it makes any difference - which it doesn't. So both setting don't work: true and false.
-
27 Jul 2012 7:12 AM #6
Maybe one interesting information: When I select a row at the top, scroll down, select additionally a row at the bottom and scroll back to the top the selection at the top remains.
If I select a row at the top scroll down (without selecting additionally a row at the bottom) and scroll up again the selection at the top disappears.
-
31 Jul 2012 6:33 AM #7
Hi,
can I help with additional information? If it is not reproducible for you, I could offer an access to our Showcase Application where this problem occurs.
-
1 Aug 2012 12:00 AM #8
Hi,
the bug can be reproduced in the following example:
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid/infinite-scroll-with-filter.html
Select a row at the top, scroll to the bottom and back up to the top: the selection disappears. The example has pruneRemoved: false set.
-
15 Aug 2012 7:35 AM #9
Hm, for me the error is pretty good reproducible in the example. Are you still having problems reproducing the problem?
How can I help?
-
16 Aug 2012 6:06 AM #10
Yes, there's a bug.
The Record instance that was selected is indeed not being pruned from the SelectionModel's list.
But when that record get scrolled back into view, the actual Record instance is different, so when it looks it up to re-apply the selection, it's not there.
It should probably use the id to match the record to be selected.
Also, if, when refreshing the selection, the record attempting to be re-selected does not exist in the store, it's not replaced back into the selection collection (even though pruneRemoved is false)
Several bugs here.
Try these overrides:
AndCode:Ext.override(Ext.selection.Model, { refresh: function() { var me = this, store = me.store, rec, toBeSelected = [], toBeReAdded = [], oldSelections = me.getSelection(), len = oldSelections.length, selection, change, i = 0, lastFocused = me.getLastFocused(); // Not been bound yet. if (!store) { return; } // Add currently records to the toBeSelected list if present in the Store // If they are not present, and pruneRemoved is false, we must still retain the record for (; i < len; i++) { selection = oldSelections[i]; if (store.indexOf(selection) !== -1) { toBeSelected.push(selection); } // Selected records no longer represented in Store must be retained else if (!me.pruneRemoved) { // See if a record by the same ID exists. If so, select it rec = store.getById(selection.getId()); if (rec) { toBeSelected.push(rec); } // If it does not exist, we have to re-add it to the selection else { toBeReAdded.push(selection) } } } // there was a change from the old selected and // the new selection if (me.selected.getCount() != toBeSelected.length) { change = true; } me.clearSelections(); if (store.indexOf(lastFocused) !== -1) { // restore the last focus but supress restoring focus me.setLastFocused(lastFocused, true); } if (toBeSelected.length) { // perform the selection again me.doSelect(toBeSelected, false, true); } me.maybeFireSelectionChange(change); // If some of the selections were not present in the Store, but pruneRemoved is false, we must add them back if (toBeReAdded.length) { me.selected.addAll(toBeReAdded); } } });
Code:Ext.override(Ext.view.AbstractView, { onMaskBeforeShow: function(){ var me = this, loadingHeight = me.loadingHeight; me.getSelectionModel().deselectAll(); me.all.clear(); if (loadingHeight && loadingHeight > me.getHeight()) { me.hasLoadingHeight = true; me.oldMinHeight = me.minHeight; me.minHeight = loadingHeight; me.updateLayout(); } } });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
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