Our powerful JS Calendar component
I am trying to sort the resources using a custom field. What am I doing wrong please?
crudManager : {
validateResponse:true,
transport : {
load : {
url : environment.baseURL + '/1/getCalendar.php?unallocYN=1',
credentials: "omit",
headers: { Authorization: 'Bearer ' + this.constantsService.access_token }
},
sync : {
url : environment.baseURL + '/1/postCalendar.php',
credentials: "omit",
headers: { Authorization: 'Bearer ' + this.constantsService.access_token }
}
},
autoLoad : true,
autoSync : true,
eventStore : {
syncDataOnLoad : true,
fields : [
{ name : 'eventType' }
],
},
resourceStore : {
syncDataOnLoad : true,
fields : [
{ name : 'order' }
],
sorters : [{ field: 'order', ascending: false }]
}
},
Thank you in advance.
It does sort the resource store.
Go to https://bryntum.com/products/calendar/examples/date-resource/
Edit the code in the code editor as below:
- Screenshot 2024-03-18 at 13.46.52.png (131.18 KiB) Viewed 308 times
You can see the resource change order.
Do you by chance mean that you want to sort the resourceFilter
's store?
Thanks Both.
Marcio, no I wasn't. I added two new classes but still not sorting.
Animal, Not sure tbh, I only have the default Filter events box in the Calendar.
export class CupResourceModel extends ResourceModel {
public order: string;
static override get fields() {
return [
{
name : 'order'
}
];
}
}
export class CupEventModel extends EventModel {
public eventType: string;
static override get fields() {
return [
{
name : 'eventType'
}
];
}
}
crudManager : {
validateResponse:true,
transport : {
load : {
url : environment.baseURL + '/1/getCalendar.php?unallocYN=1',
credentials: "omit",
headers: { Authorization: 'Bearer ' + this.constantsService.access_token }
},
sync : {
url : environment.baseURL + '/1/postCalendar.php',
credentials: "omit",
headers: { Authorization: 'Bearer ' + this.constantsService.access_token }
}
},
autoLoad : true,
autoSync : true,
eventStore : {
syncDataOnLoad : true,
modelClass : CupEventModel,
},
resourceStore : {
syncDataOnLoad : true,
modelClass : CupResourceModel,
sorters : [{ field: 'order', ascending: false }]
}
}
The resources are sorted by that sorter declaration if the resources have that field. But what are you expecting to see from that fact?
As I showed you, you would only see that in the date-resource view or resource view. Those are the only views where the resourceStore is iterated.
I want to sort this list. Thanks.
-
Attachments
-
- Screenshot 2024-03-18 152253.png (43.6 KiB) Viewed 297 times
So you do want to sort the resourceFilter
's store.
sidebar : {
resourceFilter : {
store : {
sorters : [...your sorters]
}
}
},
Works Fine. Thank you Both.