We change Infragistics.WebUI.UltraWebGrid.UltraWebGrid to Infragistics.Web.UI.GridControls.WebDataGrid. Now, we have problems with replacing.
How we can migrate this code?
var row = igtbl_addNew(gridName, 0); var grid = igtbl_getGridById(gridName); grid.clearSelectionAll();
SelectRow2(grid, grid.Rows.length-1);
igtbl_EnterEditMode(gridName);
function SelectRow2(grid, rowNum) { alert("SelectRow2"); if ((grid.Rows.length > rowNum) && (rowNum >= 0)) { grid.Rows.getRow(0).getCell(0).activate(); var row = grid.Rows.getRow(rowNum); // Set the cell as the active cell grid.setActiveRow(row); row.setSelected(true); } }
and this
row.getCellFromKey(colKey).setValue(checkedvalue);
Nikolay, I can not understand. How I can replace this JS code?
var newRow = _Grid.Rows.addNew(); _Grid.setActiveRow(currentRow);
Thanks, Nikolay!
Hello Anton,
This is how you can get reference to the grid and add new row client-side:
var grid = $find("WebDataGrid1");
// Create array of cell values for all values that cannot be null.
var row = new Array("CustomerID", "CompanyName");
// Add row.
grid.get_rows().add(row);
Clear selection:
grid.get_behaviors().get_selection().get_selectedRows().clear();
or
grid.get_behaviors().get_selection().get_selectedCells().clear();
Enter edit mode:
grid.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().enterEditMode(gridCell);
Set active cell:
grid.get_behaviors().get_activation().set_activeCell(gridCell);
Select a row:
grid.get_behaviors().get_selection().get_selectedRows().add(row);
Here is the CSOM reference for WebDataGrid - http://help.infragistics.com/NetAdvantage/ASPNET/2012.1/CLR4.0/?page=WebDataGrid~Infragistics.Web.UI_namespace.html.