I'm working with DayPilot Scheduler and need to filter events in the onBeforeTimeHeaderRender
callback function. I need to access the current filter value that was set elsewhere in my application.
In my onEventFilter
function, I'm using args.filter
successfully:
onEventFilter: (args) => {
if (Array.isArray(args.filter)) {
args.visible = args.filter.length === 0 || args.filter.includes(args.e.data.customer);
} else {
args.visible = false;
}
}
However, when I try to use the same filter in onBeforeTimeHeaderRender
to calculate filtered sums, I can't seem to access the filter value:
onBeforeTimeHeaderRender: (args) => {
if (args.header.level === 0 || args.header.level === 1) {
const events = scheduler.events.forRange(args.header.start, args.header.end);
// How do I access the same filter that was used in onEventFilter?
// Is there a way to get args.filter here?
const sum = events.reduce((acc, event) => acc + event.data.quantity, 0);
args.header.html = `${args.header.text} ( ${sum.toString()} )`;
}
}
Is there a way to access the current filter value in the onBeforeTimeHeaderRender
event? I need to use the same filter to calculate sums for only the visible events.
Any help would be appreciated. Thanks!