Hi,
I’d like to get all children of a given row.
I was – wrongly – believing that ‘getRows’ would return all rows, not only level 1, so I was expecting this code to work :
var selection = $("#treeGrid").jqxTreeGrid('getSelection');
var rowid = selection[0].MyRecordID
var allRows = $("#treeGrid").jqxTreeGrid('getRows');
var childrenRows = allRows.filter(filterFunction);
function filterFunction(element, index, array)
{
return (element.ParentID == rowid);
};
As you guessed, MyRecordID is the primary key of the record, ParentID its parent (foreign key) field
.filter being a javascript array method.
I obviously could not test it, since getRows returns only level 1 records. See a question about it in another post of mine.
Anyway, are there easy ways to get all children rows of a given parent ?
Thank you.