Results 1 to 2 of 2

Thread: Hook into keycode 23 (enter) on grid

  1. #1

    Default Hook into keycode 23 (enter) on grid

    Hi,

    I've been trying to hook into the grid's keypress in order to listen for hitting enter on a selected row. It seems to be returning an object to me, however.

    Anyone have any success with this? This is not in the context of a editable grid, but in the standard selection mode. Basically, I want to give the user the ability to scroll the grid with arrows (which is already native to the grid) and hit enter on a selected row to cause an action.

    Thanks!

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    6,956

    Default

    If you are using:
    Code:
    function handleKeyDown(e){...}
    grid.on('keydown', handleKeyDown);
    Then you will be receiving a raw event object (YAHOO.ext.EventObject).

    As far as receiving a keydown event on a particular row, I'm not sure if this will work but it might (you will need a reference to yourGrid):
    Code:
    function handleKeyDown(e){
         if(e.browserEvent.keyCode == e.RETURN){
             var row = yourGrid.getRowFromChild(e.getTarget());
             if(row){
                  // now you have your row
             }
         }
    }

Similar Threads

  1. return/enter in textarea field?
    By seldon in forum Ext 2.x: Help & Discussion
    Replies: 26
    Last Post: 27 Nov 2007, 12:58 AM
  2. EditorGrid - Pressing Enter (Help)?
    By jimbojsb in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 17 Sep 2007, 7:38 AM
  3. Enter key while input has focus fires unrelated button click
    By simeon in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 27 Apr 2007, 1:18 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
  •