Hello, I am trying to dynamically add a set of rows with first row as parent, and other rows as child of that parent.
I am doing the following:
@(Html .Infragistics() .TreeGrid(Model.GetQuoteDataRows()) .ID("otc-option-quote-page-tree-grid") .Width("100%") .Height("100%") .AutoGenerateColumns(false) .AutofitLastColumn(true) .PrimaryKey("PrimaryKey") .ForeignKey("ParentId") .ForeignKeyRootValue("0"));
I then call a function with this logic:
var grid = $("#grid"); $.each(dataRows, function (index, value) { grid.igTreeGridUpdating("addRow", value); });
Each value has the primaryKey and foreignKey field set.
However, this seems to add the rows as a flat structure, and does not keep the tree structure.
Is there another method I need to be calling on igTreeGrid?
Hello Jose,
addRow API method will add a new row to the root level only. If you want to add a child row to a specific parent row, you need to use addChild API method. Please let me know if you have any further questions.
Regards, Tsanna
Thanks Tsanna!
Another question, if I delete a tree node in the igTreeGrid, I see that the child nodes disappear from the view, but the deleted tree node is marked as deleted (strikethrough, italic, gray). Can I assume that the child nodes have also been deleted? Or do they still persist in the dataSource?
Thanks!
Jose