PDA

View Full Version : [CLOSED] TreePanel selection fails when filter is applied'



RCN
Jul 01, 2013, 7:23 PM
When a filter is applied to TreePanel items and the END key is pressed, the item selected is the last one, even if it's hidden. In my opinion, the item selected sould be the last visible one.

Open the Ext.Net examples
http://examples.ext.net

6478

Type a Filter
6479

Press Arrow Down key

Press END key

Press Enter key

Note that the application opened is the last one of the menu (it's hidden), not the last shown (due the filter applied)

Any ideas to overcome this issue?

Baidaly
Jul 01, 2013, 11:59 PM
Hi, Raphael!

Try to add the following overriding:



Ext.override(Ext.selection.RowModel, {
onKeyEnd: function (e) {
var me = this,
view = me.views[0];

if (view.bufferedRenderer) {
// If rendering is buffered, we cannot just increment the row - the row may not be there
// We have to ask the BufferedRenderer to navigate to the target.
// And that may involve asynchronous I/O, so must postprocess in a callback.
view.bufferedRenderer.scrollTo(me.store.getCount() - 1, false, function (newIdx, newRecord) {
me.afterKeyNavigate(e, newRecord);
});
} else {
var visibleNodes = view.getNodes().filter(function (item) { return !item.classList.contains('x-hidden'); });
var number = Number(Ext.fly(visibleNodes[visibleNodes.length - 1]).getAttribute('data-recordindex'));
me.afterKeyNavigate(e, view.getRecord(number));
//me.afterKeyNavigate(e, view.getRecord(view.all.getCount() - 1))
}
},

// go to first visible record in grid.
onKeyHome: function (e) {
var me = this,
view = me.views[0];

if (view.bufferedRenderer) {
// If rendering is buffered, we cannot just increment the row - the row may not be there
// We have to ask the BufferedRenderer to navigate to the target.
// And that may involve asynchronous I/O, so must postprocess in a callback.
view.bufferedRenderer.scrollTo(0, false, function (newIdx, newRecord) {
me.afterKeyNavigate(e, newRecord);
});
} else {
var visibleNodes = view.getNodes().filter(function (item) { return !item.classList.contains('x-hidden'); });
var number = Number(Ext.fly(visibleNodes[0]).getAttribute('data-recordindex'));
me.afterKeyNavigate(e, view.getRecord(number));
//me.afterKeyNavigate(e, view.getRecord(0));
}
}
});


We will investigate it.

RCN
Jul 02, 2013, 4:58 AM
Thank you Baidaly. Please keep me posted.

Daniil
Jul 02, 2013, 5:40 AM
Hi,

The problem is the fact that ExtJS doesn't support TreeStore filtering. It is implemented in Ext.NET.

So, the pure ExtJS methods like a RowModel onKeyEnd, onKeyHome, onKeyPageDown, onKeyPageUp do not know anything about our filtering. So, if you need to change the behavior of those methods, please override it as @Baidaly suggested.

Maybe, at some point we will review it and be able to bake it direct into Ext.NET, though I would rather hope that ExtJS finally bakes TreeStore filtering in their toolkit. This feature is very often requested by the community.