I have a WebDataGrid, 11.1 that allows in cell editing. When the user hits the enter key to finish editing I woudl like to navigate to the next cell. Preferably I would like to be able to be able to control whether that is the next row or the next column.
Before I start getting involved in writing a lot of javascript to do this I was wondering if this is a built in behavior that I am not seeing how to configure or if there is a simple example of how to do it.
Thanks in advance.
I think I found the answer myself. This code seems to work, but one line seems a little strange to me.
function WebDataGrid1_CellEditing_ExitedEditMode(sender, eventArgs){ ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.EditModeEventArgs"></param>
// Commit the changes to the server var oBehavior = sender.get_behaviors(); oBehavior.get_editingCore().commit();
// Move to the next cell var oCurrentCell = eventArgs.getCell();
// Make the new cell active var oUtility = new Infragistics.Web.UI.GridUtility();
// Not sure why I have to set this property - it doesn't seem to be a documented property. oUtility._grid = sender;
var oNextCell = oUtility.getNextCellVert(oCurrentCell); oBehavior.get_activation().set_activeCell(oNextCell);
}
I'm using the GridUtility object and I am explicitly setting the _grid prperty:
oUtility._grid = sender;
If I don't do this then the getNextCellVert function has a nell reference exception on the _grid property. Is this the correct way to do this?
If there is a better way of doing this I would like to know.
Hi wamanring,
When you create the grid utility, you should pass in the grid as an argument to the constructor. That's why it was null. Off of the grid, there actually is a grid util already. grid._gridUtil. However, using these methods are not necessarily supported if they do not work as they are internal. The getNextCellVert should work fine, but beware this code will fire even if someone just clicks off the grid and it exits edit mode.
regards,David Young
Hi,
Thanks for your respone. But still i'm gettting the same error.
The Infragistics documentation does not show any argumanets to the constructor for the GridUtility object. Donig things this way worked for me:
var oUtility = sender._gridUtil;oUtility._grid = sender;
It seems a bit redundant, but it is working.
I passed the grid as an argument, but still i'm getting null error. how to solve this error?
function grdTool_CellEditing_ExitedEditMode(sender, eventArgs) { //var control = $find("grdTool"); //document.getElementById('grdTool');
///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.EditModeEventArgs"></param>
// Make the new cell active var oUtility = new Infragistics.Web.UI.GridUtility('WebDataGrid1');
var oNextCell = oUtility.getNextCellVert(oCurrentCell); oBehavior.get_activation().set_activeCell(oNextCell); }
Hi David,
I tried that script but it's not working for me. I entered data in first cell and press enter key, that data is committed. I placed that script within header part and i called it using
<CellEditingClientEvents ExitedEditMode="WebDataGrid1_CellEditing_ExitedEditMode" />
Hi Ivenkat,
You have to write custom java script in order to do this. Similar to what the poster had to do.
regards.
David Young