Page 2 of 2

Re: [ANGULAR] How I implement Resource View with custom resourceFilter

Posted: Wed Mar 29, 2023 1:02 pm
by braincept

This is our code.
we are catching events in HTML with "onCatchAll".
resourceFIlter is working base on 'trigger' used in function 'setupResourceFilter'


Re: [ANGULAR] How I implement Resource View with custom resourceFilter

Posted: Wed Mar 29, 2023 1:12 pm
by braincept
Animal wrote: Wed Mar 29, 2023 12:43 pm

Widgets are reconfigurable all the way down:

Screenshot 2023-03-29 at 12.42.23.png

Thanks for suggestion.
It really helps.


Re: [ANGULAR] How I implement Resource View with custom resourceFilter

Posted: Thu Mar 30, 2023 8:04 am
by Animal

Glad the hint helped.

I noticed a few things.

Typo. I assume this should be translationPipe:

Screenshot 2023-03-30 at 07.19.23.png
Screenshot 2023-03-30 at 07.19.23.png (24.81 KiB) Viewed 235 times

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):

Screenshot 2023-03-30 at 07.15.20.png
Screenshot 2023-03-30 at 07.15.20.png (50.56 KiB) Viewed 235 times

Here is your bug I think:

Screenshot 2023-03-30 at 07.30.39.png
Screenshot 2023-03-30 at 07.30.39.png (327.56 KiB) Viewed 235 times

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:

bugged.gif
bugged.gif (682.96 KiB) Viewed 235 times

If you configure the resourceFilter with selectAllItem : true it of course keeps it synced. You do not need to intervene:

selectall.gif
selectall.gif (360.52 KiB) Viewed 235 times

Re: [ANGULAR] How I implement Resource View with custom resourceFilter

Posted: Thu Mar 30, 2023 9:17 am
by braincept

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?


Re: [ANGULAR] How I implement Resource View with custom resourceFilter

Posted: Thu Mar 30, 2023 9:54 am
by Animal

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.