The Trinidad table provides default sorting support when a Java Array or List is used for the Table data. This is done by wrapping the Array or List with a SortableModel. SortableModel sorts the collection in it's implementation of the setSortCriteria() method.
The Trinidad Tree and TreeTable also accept List-of-Lists or Arrays-of-Arrays which are then wrapped by a ChildPropertyTreeModel. The implementation of the ChildPropertyTreeModel also uses the SortableModel to wrap the parent and child collections. So theoretically, it should be possible to support default sorting in tree/treeTable when a List-of-List or Array-of-Array is used for Tree data. I would like to provide a patch to do this. Specifically, I would like to propose the following: 1) Modify the Trinidad UIXTree to call setSortCriteria() on the TreeModel in it's broadcast() method when a Sort event is being broadcast. This is similar to UIXTable. This will enable the renderer to queue a sort event and have the model get notified prior to broadcasting the event. 1a) The renderer can set "row currency" to either a null or a non-null rowKey prior to queueing the event so that the model knows either that the entire tree is getting sorted (null rowKey) or the children of a particular node are getting sorted (non-null rowKey). 2) Modify ChildPropertyTreeModel so that it sorts the root collection or child collections based on the "row currency" defined in 1a. I can provide more detail on the proposed use-case (lazy recursive sorting of the ChildPropertyTreeModel, and sorting of child nodes using different sort criteria, etc) in a separate email. With this email, I would like to start a discussion and know if there is any interest in doing this. Thanks Kamran
