Skip to main content

Posts

Showing posts with the label #adf table sort

Column Sorting in ADF TreeTable

Sorting of columns are not supported in ADF TreeTable by default.  The documentation of 12c says : Unlike the Table, the TreeTable does not support automatic sorting. The underlying TreeModel must support sorting by implementing it's sorting logic in the  setSortCriteria(List criteria)  method of the TreeModel. But my client wanted sorting on the tree table on few columns. It was a good challenge and this is how I solved it. Steps : 1. The treeModel is based on a managed bean. You cannot have the tree based on ADF-BC bindings. Simply because you need to override setSortCriteria(). 2. Added a few Comparators required for sorting of the columns. Assumptions : 1. Code is in Java 8, using one of the lamda methods of Collections. Lets get into the implementation details 1. Tree is based on a simple POJO.  public class UCMContent {          // tree hierarchy in the list of child     private Lis...