Page 1 of 1

Default sorting on a field

Posted: Fri Jun 09, 2023 11:16 am
by Rakesh Nagapuri

Hi Team,
I am trying to sort the records of Gantt chart based on a column by default whenever a Gantt chart is loaded. When the user selects sorting on another column, I am trying to store that sorter in a cache and passing that to sorter value in Store. It looks like that is not working as expected. Can you please help me in understanding how I can achieve that.

const customStore= new Store({
      sorters: this.customConfig.sorters,
 });

Ganttchart :

new Gantt({
	.....
	.....
	store : this.customStore,

});

customConfig.sorters

It contains an array of object with keys as
{
ascending: boolean;
field: string;
}

Note: I was referring to this document when I am trying to fix that
https://bryntum.com/products/gantt/docs/api/Grid/feature/Sort


Re: Default sorting on a field

Posted: Fri Jun 09, 2023 11:50 am
by tasnim

Hi,

Instead of creating a custom store, please try adding the sorter with https://bryntum.com/products/gantt/docs/api/Gantt/data/TaskStore#function-addSorter

This should help


Re: Default sorting on a field

Posted: Fri Jun 09, 2023 4:09 pm
by Rakesh Nagapuri

That works. Thank you