Welcome Guest Search | Active Topics | Sign In | Register

Grid Client Question! Options
sjf
Posted: Monday, November 29, 2010 12:59:22 AM
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?
eo_support
Posted: Monday, November 29, 2010 9:56:28 AM
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.aspx

The 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.aspx

Hope this helps. Please feel free to let us know if you have any questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.