Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Has anyone else experienced this issue: When I use a List Box with Treeview enabled, and then attempt to sort by an expression (in my case just a single field), the sorting doesn't consistently work at all levels.
The weird thing is that depending on other circumstances it sometimes works and sometimes does not work. Sometimes encapsulating the sort field in "Max()" works, depending on the hierarchy.
To give you some more info, the Path field I'm using was constructed using the "hierarchy" command in the load script, and everything displays correctly (as a tip for using Treeview: be sure to choose a delimiter character that is guaranteed not to show up in the path nodes [e.g. '~']).
Could I be doing something wrong, or is this a legitimate bug?
I've found a workaround to this bug.
Namely, just load the records in the order you desire (e.g. ...ORDER BY list_order) , and then sort by load order within the List Box control. This sorts the list correctly, even when in Tree-View mode.
Workaround trade-offs:
The drawback to this approach is that you're beholden to a single sort order for the path in question.
The advantage is that you can leave the sort order field out of your data model, thereby simplifying it and saving on memory.
I agree that the biggest drawback to this approach is the single sort order.
Check out the following discussion for an example of the issue, and hopefully a resolution.