Results 1 to 2 of 2

Thread: Override TreePanel to support onkeyup, onkeydown events

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    5

    Default Override TreePanel to support onkeyup, onkeydown events

    Hi guys,

    I'm stuck on overriding the TreePanel to support onkeyup and onkeydown events
    on child nodes. I've basically followed the thread post http://www.sencha.com/forum/showthre...to-form-fields that was
    basically doing the same for Forms.

    So I've added the following:
    Code:
    Ext.override(Ext.tree.TreePanel, {
                fireKey : function(e) {
                    if(((Ext.isIE && e.type == 'keydown') || e.type == 'keypress') && e.isSpecialKey()) {
                        this.fireEvent('specialkey', this, e);
                    }
                    else {
                        this.fireEvent(e.type, this, e);
                    }
                }
              , initEvents : function() {
    //                this.el.on(Ext.isIE ? "keydown" : "keypress", this.fireKey,  this);
                    this.el.on("focus", this.onFocus,  this);
                    this.el.on("blur", this.onBlur,  this);
                    this.el.on("keydown", this.fireKey, this);
                    this.el.on("keypress", this.fireKey, this);
                    this.el.on("keyup", this.fireKey, this);
    
                    // reference to original value for reset
                    this.originalValue = this.getValue();
                }
    });
    I'm not understanding why after adding this cose, all the TreePanels
    of my code are just messed up: rendering is completely broken.

    Is there any other way to catch onkeyup and onkeydown (basically following
    up/down arrow keys while going up/down in the tree nodes) to the TreePanel?

    Please let me know
    Thanks for your time
    mik001

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Posts
    5

    Default

    I've also tried a different approach, that I've found later reading the doc.
    I've added to my TreePanel definition the following, but without any result again:

    Code:
     keys: [
                { key: Ext.EventObject.UP, fn: function() {
                        console.log("keyup");
                    }
                },
                { key: Ext.EventObject.DOWN, fn: function() {
                        console.log("keydown");
                    }
                }
            ]
    This should work, at least as per-doc.

    Can someone please explain me what it wrong?

    Thanks
    mik001

Similar Threads

  1. ListView, OnKeyDown and Chrome
    By Algiano in forum Ext GWT: Discussion
    Replies: 6
    Last Post: 10 Aug 2010, 1:11 AM
  2. css override to support text wrapping in ListViews and GridPanels
    By mpelzsherman in forum Community Discussion
    Replies: 0
    Last Post: 12 Nov 2009, 3:31 PM
  3. Override Observable and add events
    By markpele in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 6 Jul 2009, 5:57 AM
  4. onKeyDown event
    By robert6000 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 14 Feb 2008, 6:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •