I have a tableview which has an observable list of custom class objects attached to it (Class type: SalesInvoiceNetSale). The data all displays fine within the table. The la
Here is the code to do the same thing with a TreeTableView
in Java8 and lambda expressions.
treeTable.sortPolicyProperty().set(treeTableView -> {
Comparator super TreeItem> comparator = (model1, model2) -> {
if(model1.isTotalRow()) {
return 1;
} else if(model2.isTotalRow()) {
return -1;
} else if (treeTableView.getComparator() == null) {
return 0;
} else {
return treeTableView.getComparator().compare(model1, model2);
}
};
treeTable.getRoot().getChildren().sort(comparator);
return true;
});