Sorting on only leaf task


#1

I want to display only leaf tasks in sorted order after clicking on a column heading without any hierarchy using javascript.
I tried all possible ways but it shows hierarchy sorting of leaf tasks. Is there a solution to this problem?


#2

Hello Kavisha,
You need to use a custom sorting function:
https://docs.dhtmlx.com/gantt/desktop__sorting.html#programmaticsorting
https://docs.dhtmlx.com/gantt/desktop__sorting.html#customsortingfunctions
Then you need to attach it to the grid column header by modifying the label parameter in the column configuration:
https://docs.dhtmlx.com/gantt/api__gantt_columns_config.html

If you don’t want to see some tasks, you can hide them with the onBeforeTaskDisplay event handler:
https://docs.dhtmlx.com/gantt/api__gantt_onbeforetaskdisplay_event.html

Here is an example of how it can be implemented:
http://snippet.dhtmlx.com/5/26e42be85

If you need something different, please, describe your question in more detail. You can also send me a picture of how you imagine it should work.