Hi all,
I'm having troubles setting focus to the next cell in my grid. Here is my situation:I have a UltraWegGrid that contains studentnames and multiple columns for grades they score on tests. If a user enters a score , the cell below the one just used should become active. This should happen after a TAB, ENTER of maybe even a keydown keypress.I have found this example:http://forums.infragistics.com/forums/p/12988/48099.aspx#48099Wich pointed me to the AfterExitModeHandler. (see code below). This one works, but only when TAB is pressed!! If i hit enter the cell below will become SELECTED, but not Editable?!how can i make the Enterkey or the keydown key respont to this piece of code?Can i fire this event from the KeyDownEvenHandler? (can events be nested, or how should i call that?)
I look forward hearing from you
CheersEelkocode from link:function AfterExitEditMode(gridID, cellID) { var grid = igtbl_getGridById(gridID); var cell = igtbl_getCellById(cellID); var cellIndex = cell.Index; var rowIndex = cell.Row.getIndex();
if (cellIndex > 0) cellIndex--; var newCellID = gridID + "_rc_" + (rowIndex + 1) + "_" + cellIndex; var newCell = igtbl_getCellById(newCellID); if (newCell != null){ newCell.activate(); } }
Here is what I am using
function SelectNextCell(gridClientId) { var grid = igtbl_getGridById(gridClientId); var cell = grid.getActiveCell();
if (cell != undefined && cell != null) { var nextCell = cell.getNextTabCell(); while (nextCell != undefined && nextCell.isEditable() == false) { nextCell = nextCell.getNextTabCell(); }
if (nextCell != undefined) { cell.setSelected(false); nextCell.activate(); nextCell.setSelected(true); grid.beginEdit(); } }}
Oke,. i understand i need to user the OnKeyDown event, thanx!What code is in your SetNextCell() fuction?
In addition to the afterexitmode handler, you need the keydown handler. here is the java code that I use.
Regards,
Willie
function
OnUwgKeyDown(gn, cellId, KeyStroke) {
// Tab Key
(KeyStroke == 9) {
SelectNextCell(gn);
;
}
(KeyStroke == 13) {
I have to make an addition:I just noticed that when the cell is selected (after pressing enterkey) i can start typing, and the cell accepts what i'm typing as input.this is acceptable, but i realy would like to have the enterkey act the same as the tab. then i can also make the keydown key to act as tabkey.