The current method .igGridUpdating("addRow", values) will add a row at the bottom of the grid. How can I insert a row at a desired location.
For example, there are 5 rows in the grid. I select a row (index=2), then click on an Insert button (in my application) to have the new grid row added in front of row index 2. The new row is now at index 2.
Thanks.
Hi Erica,
You can use $.ig.igDataSource.insertRow method. igGrid internally keeps a variable to $.ig.DataSource instance. You can get it with the following code: $("#grid1").data("igGrid").dataSource; Then you only need to call the insertRow method and rebind the grid.
I've attached a sample which demonstrates this. First press the "Insert row" button and then "Rebind grid" button in order to see the record in the grid.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Hello Martin
Can you provide a sample with hierarchical grid about how to insert a child row in a parent (existing parent) row, please ?
Thanks in adavance.
Gilles
here is a solution:
// Retrieve the parent row as ACCOUNT for the exemple var oldRow = $("#hierarchicalGrid").data("igGrid").dataSource.findRecordByKey(accountId);
// apply change to the childs[] oldRow.Visits.push(new visitObject(results));
// then Update the row with the Updated childs[] in the source $("#hierarchicalGrid").data("igGrid").dataSource.updateRow(accountId, oldRow);
// And rebind the source $("#hierarchicalGrid").igGrid("dataBind");
hope this help