Rank: Member Groups: Member
Joined: 11/27/2010 Posts: 13
|
hi, When the cell get focus,i want to let it into edit mode,and input something,Keydown <Enter> then go to next cell,and next cell into Edit Mode,Please tell me how to do?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, See here for more details about how to automatically edit a cell when the cell gets focus: http://www.essentialobjects.com/forum/postst3841_How-to-automatically-edit-an-cell-when-the-cell-receives-focus.aspxThe Grid does not handle <Enter> key to go to the next cell. So you will need to handle the keydown event on the document level and then call the Grid's client side API to move the focus. The code will be something like this:
Code: JavaScript
//Get the Grid object
var grid = eo_GetObject("Grid1");
//Exit edit mode
grid.editCell(-1, -1);
//Get the current selected cell's row and column index
var selectedCell = grid.getSelectedCell();
var itemIndex = selectedCell.getItemIndex();
var cellIndex = selectedCell.getColIndex();
//Adjust row and column index to the next cell
cellIndex++;
if (cellIndex >= grid.getColumnCount())
{
itemIndex++;
cellIndex = 0;
if (itemIndex >= grid.getItemCount())
itemIndex = 0;
}
//Set the new selected cell
grid.selectCell(itemIndex, cellIndex);
The above code uses our client side API extensively. If you have not used our client side API before, you will want to go over this topic first: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxHope this helps. Please feel free to let us know if you have any questions. Thanks!
|