Is there any example on how to do a batch update on igHierarchicalGrid? I folllowed the example for igGrid to get pending transactions on the child table using code below and always got empty string.
grid.data('igGrid').dataSource.transactionsAsString();
Hello drchip,
I have been looking into your questions and I could suggest you get all transactions in the igHierarchicalGrid like this:
var trans= new Array();
var transCount=0;
for(var i=0;i<$("#grid1").igHierarchicalGrid("allChildren").length;i++)
{
trans[transCount]=$($("#grid1").igHierarchicalGrid("allChildren")[i]).igGrid("transactionsAsString");
transCount++;
}
trans;
Please let me know if this helps.
Elena, thanks for the tip. I have another question. When adding a new record to the child grid, the method "transactionsAsString" does not include the parent key Id. How would I get the parent key?
From the transaction string you can get the id of the updated rows. For example if the id of this row equals 6 then you can get its DOM element like this:
var currentUpdatedRow= $($("#grid1").igHierarchicalGrid("allChildren")[0]).find("tr[data-id=6]")
where $($("#grid1").igHierarchicalGrid("allChildren")[0]) returns the child grid where this record is placed.
Then you can get its parent row using the following snippet:
currentUpdatedRow.parents("tbody").last().prev()
Once you have the parent row you can just get its “data-id” attribute which contains the id.