I'm trying to implement sorting of tree implemented with NatTable but I can't really understand how it works. My problem is that after the sorting of any column other than 'tree' column child nodes can move to invalid parent. Though the order of elements is correct on all levels of hierarchy. So basically I don't understand the purpose of TreeList.Format.getComparator()
and how it related to comparators registred for the columns, and I don't understand when and why node can change its parent.
I've started with the example TreeGridExample and I've managed to create test data with which I have the same problem
private void createDatums() {
createDatum(null, "a", 2);
createDatum("a", "aa1", 0);
createDatum(null, "b", 0);
createDatum("b", "bb1", 0);
createDatum(null, "m", 1);
createDatum(null, "n", 0);
}
If I sort column bar
, bb1
node jumps from b
to n
and when sorting removed, it again is child of b