How to sort columns using Angular

Hi there!

I am trying to sort the columns based on one of the Task fields (specifically, the column on index[0]), and I have the following code:

gantt.config.sort = true;

gantt.attachEvent('onGanttRender', function() {
  gantt.config.columns[0].sort = true;

However, when the chart is rendered, the columns are not sorted. I am also trying something like this:

gantt.attachEvent('onGanttRender', function() {
  gantt.config.columns[0].sort = function(a,b){

but in that case, I don’t even get to see sorting... in the console.

Any ideas how to do this? Thank you guys!

I found my solution thanks to ramil’s answer in this post Sort Gantt tasks by start date on initial load raises error

I was trying to sort by column on the initial load, and I didn’t know I was complicating things with all the code above.

i just needed to add this line after parsing the chart
gantt.sort('user', false);