I need to add a child row from the parent, and when its added it should automatically enter into edit mode, so that the user can enter the information and save.
All I have now is that it adds a new child row, but I can't get it to enter the edit mode automatically
Thank YOu
Function AddDetail
{
var grid = ig_controls["WebHierarchicalDataGrid1"].get_gridView();
var gridrow = grid.get_behaviors().get_activation().get_activeCell().get_row();
gridrow.get_grid().get_rows().get_row(gridrow._index).set_expanded(true);
var rowislands = gridrow.get_rowIslands();
var childGrid = rowislands[0];
if (childGrid != null) {
var CodeNum = gridrow.get_cell(1).get_value();
var row = new Array(CodeNum);
gridrow.get_rowIslands()[0].get_rows().add(row);
}
Hello,
Thank you for contacting us.
About your question, in order to set cell to be in edit mode you should have CellEditing behavior enabled. Then you can use enterEditMode function which accepts two parameters, the cell that you want to put in edit mode and the key of the column.
For example:
var firstRowIsland = ig_controls.WebHierarchicalDataGrid1.get_gridView().get_rows().get_row(0).get_rowIslands()[0];var cellEditingBehavior = firstRowIsland.get_behaviors().get_editingCore().get_behaviors().get_cellEditing();
var cell = firstRowIsland.get_rows().get_row(0).get_cellByColumnKey("Quantity");
cellEditingBehavior.enterEditMode(cell, "Quantity");
Let me know if I may be of further assistance.
Is there any way to do that for a whole row?
I am using the following code that you provided, It does not cause any errors, but does not either enter Edit Mode
var firstRowIsland = ig_controls.WebHierarchicalDataGrid1.get_gridView().get_rows().get_row(0).get_rowIslands()[0]; var cell = firstRowIsland.get_rows().get_row(0).get_cellByColumnKey("JobNumber"); var grid = ig_controls["WebHierarchicalDataGrid1"].get_gridView(); grid.get_behaviors().get_editingCore().get_behaviors().get_rowEditing().enterEditMode(cell,"JobNumber")
Yes, you should access the RowEditing behavior and again use the enterEditMode:
ig_controls.WebDataGrid1.get_behaviors().get_editingCore().get_behaviors().get_rowEditing().enterEditMode
enterEditMode: function (cell, key){ /// <summary locid="M:J#Infragistics.Web.UI.RowEditing.enterEditMode"> /// Causes the grid to enter row-edit mode. /// </summary> /// <param name="cell" type="Infragistics.Web.UI.GridCell">The cell which gets request (mouse click or key press) to enter edit mode.</param> /// <param name="key" type="String" optional="true">Optional. Used internally to send pressed key to editor when entering /// via key press is used.</param> /* VS 03/05/20014 Bug 165930: filtering/addNewRow */ if (!cell) return; this._cellEditBlock(); var me = this; setTimeout(function () { me._enterEditMode(cell, key); }, 1);},