3.0.5

Browsing the grid using arrow keys / Enter key edit-loose focus

Hey guys!

Was pretty impress about this nifty widget! I need to use it in one of my applications. What I want to do is:
1. use the arrow keys to navigate the grid
2. use Enter key to change the content of a cell
3. use Enter key again to "confirm" the content of edited cell
4. use Enter key to move to first cell in the right of current cell

The 2 and 3 list items described above are done [I mean, I managed to make it work]. I need some help with 1 and 4 items. Can you help?

Here is the way I get to... but did not move forward for a couple of hours, as I'm stuck:

// trying to handle the ENTER key and ARROW keys
    var defaultEventHandler = obj.getEvent("onkeydown");
    obj.setEvent("onkeydown", function(e){
        if(event.keyCode==13){ // enter key
            // need to move to the next right cell
        }
        else if(event.keyCode==37){ // left key
            // move the selection to the left 1 cell
        }
        else if(event.keyCode==39){ // right key
            // move the selection to the right 1 cell
        }
        else if(event.keyCode==38){ // up key
            // move the selection up 1 cell
        }
        else if(event.keyCode==40){ // down key
            // move the selection down 1 cell
        }
        else{
            defaultEventHandler.call(this, event);
            event.returnValue = false;
        }
    } );
Stefan [RO]
October 27,
1) is already the default behavior of the grid, you don't need to do anything.

4) You either have to choose 2 or 4, how is the program going to know if you want to Edit or move the cursor?

I suggest that you modify #3 and move the selected cell after you post the data. I suggest that you remove your arrow key code from your above function.

What browser are you trying this in and what version of AW are you using?
Jim Hunter
October 27,
Hey Jim!

Thank you for your reply. May previous post was for ActiveWidget 1.0. I moved now to ActiveWidget 2.0 beta 1 and it works fine!

I miss the lack of triggering an event after the user edited the cell [onblur]. Do not know how to do that... :(

Stefan
Stefan [RO]
October 28,

This topic is archived.

See also:


Back to support forum