Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
How to make the enter key navigate to a new cell after editing
posted

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.

Parents
  • 445
    posted

    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.

Reply Children