Apply default sort then remove when mounted

Hi all,

We would like to apply a default sort to the gantt chart when the control/page loads for the first time e.g.

sortSettings: {
columns: [{field: 'startDate', direction: 'Ascending'}, {
field: 'endDate',
direction: 'Ascending'
}]
},

Once the control is loaded, we would like to remove the sorting (reason is that our gantt's contain many tasks and they keep jumping around or out of the focus of the screen when dates are changed etc).

We have tried the following, but it refreshes the order of the tasks after the removeSortColumn() are called:

mounted() {
let vm = this;
vm.ganttObj.removeSortColumn("startDate");
vm.ganttObj.removeSortColumn("endDate");

Is there a way to load the gantt with an initial sort and then remove it without losing this ordering?

Thanks



4 Replies 1 reply marked as answer

PP Pooja Priya Krishna Moorthy Syncfusion Team March 26, 2021 02:09 PM UTC

Hi Samantha, 
We have prepared a sample with initial sorting(say startdate). And modified the start date of record, dynamically. 
But the order was maintained as it renders in load time even after edit action. Please find the sample from below link. 
Please modify our sample to reproduce the issue. So that it will be very helpful to check from our end and provide you proper solution. 
  
Regards, 
Pooja K 



SE Sean March 29, 2021 11:07 AM UTC

Hi Pooja, 

This is not exactly what we are looking for.

We are looking for a way to:
  1. Have the data sorted by some columns when the Gantt first loads.
  2. But then have the sort turned off.
So in your example, the problem is that the gantt is still sorted by "Start Date" when the control is loaded.


PP Pooja Priya Krishna Moorthy Syncfusion Team March 30, 2021 03:02 PM UTC

Hi Samantha, 
Currently, while dynamically disabling the allowSorting property, the sorted order was not maintained. 
We are checking the possibilities to achieve it in work-around solution and update you further details in one business day(March 30, 2021). 
Until then we appreciate your patience. 
  
Regards, 
Pooja K. 



PP Pooja Priya Krishna Moorthy Syncfusion Team March 31, 2021 12:27 PM UTC

Hi Samantha, 

We are sorry to say that, we tried to achieve your requirement by workaround solution, but it is not possible to load the sorted data and to dynamically disable sorting. If we disable the sort action dynamically, the sorted data will not be maintained. This is the current behavior of Gantt.  

Henceforth, we suggest you to bind the sorted data to the Gantt without enabling the sorting functionality. So that sorting will be maintained. 

Regards, 
Pooja K 


Marked as answer
Loader.
Up arrow icon