[CLOSED] TreePanel selection fails when filter is applied'

  1. #1

    [CLOSED] TreePanel selection fails when filter is applied'

    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
    https://examples2.ext.net

    Click image for larger version. 

Name:	img1.png 
Views:	22 
Size:	15.8 KB 
ID:	6478

    Type a Filter
    Click image for larger version. 

Name:	img2.png 
Views:	19 
Size:	11.2 KB 
ID:	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?
    Last edited by Daniil; Jul 10, 2013 at 3:51 AM. Reason: [CLOSED]
  2. #2
    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.
  3. #3
    Thank you Baidaly. Please keep me posted.
  4. #4
    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.

Similar Threads

  1. Replies: 13
    Last Post: Mar 16, 2015, 7:28 PM
  2. Replies: 8
    Last Post: Feb 11, 2015, 8:55 PM
  3. Replies: 3
    Last Post: May 10, 2013, 11:24 AM
  4. Replies: 1
    Last Post: Mar 19, 2012, 1:54 PM
  5. [CLOSED] GridFilter unchecked, but filter still applied
    By ecko in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Mar 10, 2012, 2:35 PM

Posting Permissions