Hi,
I have a grid that allows for new rows to be inserted. I have logic in a client side JS event handle for editCellEnded that changes one of the cell values based on others. It works as expected for existing rows in the grid and successfully updates the cell. However, when I add a new row to the grid and edit one of the cells, I get an error when trying to update one of the cells using Javascript I can see the rowID is correctly set as well as the columnKey. Is there some restriction on doing this until the grid changes are persisted?
Javascript call in EditCellEnded handler that causes the issue.
//success - getting values out of the grid no problem - where Row id is variable holding the ID of the row
var N_Awarded = $("#Grid_101).igGrid("getCellValue", RowID, "N_Feasible");
//causes error
$("#Grid_101).igGridUpdating("setCellValue", RowID, "Cost_1", UpdatedCost);
Thanks in advance.
Hello Darryl,
I am glad that you find my suggestion helpful and were able to achieve your requirement.
Thank you for using Infragistics components.
Regards, Monika Kirkova, Infragistics
Thank you
192.168.l.l routerlogin 192.168.0.1
After investigating this further, I determined that the cell value could be changed in two ways.
The first option is to get the id of the new row in a method bound to the rowAdding event and to use that id in the editCellEnded as follows:
rowAdding: function (evt, ui) {
rowID = ui.values.ID;
},
editCellEnded: function (evt, ui) {
if (!ui.rowAdding) {
rowID = ui.rowID;
}
var N_Awarded = $("#grid").igGrid("getCellValue", rowID, "Maker");
$("#grid").igGridUpdating("setCellValue", rowID, "Model", N_Awarded);
The other option is to change the cell value for the newly added row directly in the method bound to the rowAdding event and in the editCellEnded to change the value only if the row is already in the grid:
ui.values.Model = ui.values.Maker;
var N_Awarded = $("#grid").igGrid("getCellValue", ui.rowID, "Maker");
$("#grid").igGridUpdating("setCellValue", ui.rowID, "Model", N_Awarded);
Below I am attaching a sample, demonstrating the described behaviors. Please test it on your side and let me know if you need any further information regarding this matter.
igGridSetCellValue.zip