Hi team
Can we sort events in the week view based on the event name
Hey vconstruct,
Yes, you'll probably need to listen to the view change (to identify when the week view is being set) https://bryntum.com/products/calendar/docs/api/Calendar/view/Calendar#event-activeItemChange
And inside of that, you can add a sort to the eventStore https://bryntum.com/products/calendar/docs/api/Scheduler/data/EventStore#function-sort
And if you don't want to keep the sort on other views, you can use the activeItemChange event listener to remove the sort using https://bryntum.com/products/calendar/docs/api/Scheduler/data/EventStore#function-clearSorters
Best regards,
Márcio
We want the events to be sorted based on name instead of start date.
eventSorter function in modeDefaults worked for month view but its not sorting for week view
modeDefaults : {
eventSorter(a:any,b:any) {
a = a.data.name
b = b.data.name
if(a < b){
return -1;
}else if(a > b){
return 1;
}else{
return 0;
}
}
},
The above almost works. It is short of just a few tweaks. But it should of course fully work.
Here's a ticket to make it work: https://github.com/bryntum/support/issues/6913
Of course a multi day event will poke out into future cells, so might be out of order in those cells.
But there's nothing we can do about that. You see "Hackathon" is correctly sorted into second position in name order in the first cell. But a multi day event is a continuous bar, so future cells have to sort themselves around that fixed part.