Re: [ANGULAR] How I implement Resource View with custom resourceFilter
This is our code.
we are catching events in HTML with "onCatchAll".
resourceFIlter is working base on 'trigger' used in function 'setupResourceFilter'
This is our code.
we are catching events in HTML with "onCatchAll".
resourceFIlter is working base on 'trigger' used in function 'setupResourceFilter'
Glad the hint helped.
I noticed a few things.
Typo. I assume this should be translationPipe
:
These settings are irrelevant in MonthView or AgendaView. They shows whole day cells. These settings are all DayView things (Don't forget that a WeekView is just a multi day DayView):
Here is your bug I think:
You inject a trigger
method into the widget. This overrides the broadcasting of events, and therefore disables all event broadcasting.
This will break how filtering works. Nobody can subscribe to its events. Never override the trigger
method. Add a listener
:
this.sidebar.items.resourceFilter = {
type: 'calensoresourcefilter',
weight: 300,
selected: {
values: selectedValues
},
multiSelect: true,
// Listen for the item action
listeners : {
item({ source, record }) {
// Does the resourceFilter (source is the event broadcaster) have this record selected?
const isSelected = source.selected.includes(record);
}
}
I changed it in the example. Notice how the events filter out, but the resource subview stays:
If you configure the resourceFilter with selectAllItem : true
it of course keeps it synced. You do not need to intervene:
First of all thanks for your quick response and I really appreciate the way you provided all the feedbacks.
However, I want to clarify, if I replace resource filter's trigger with listner then possibility to hide/remove resource subview?
It obviously does this automatically. See the example: https://bryntum.com/products/calendar/examples/resourceview/
It would be a bad bug on our part if we did not do this.