Our pure JavaScript Scheduler component


Post by burnit »

Hi,

i would like to add a button which opens a menu with checkboxes.
If i unselect a checkbox i want that the ressource disappears from view.
How is that possible?

Many thanks,
André


Post by marcio »

Hey André,

I believe you'll find useful the following documentation https://bryntum.com/products/scheduler/docs/api/Core/widget/Menu

You can set up something like this

const menu = new Menu({
    anchor   : true,
    autoShow : false,
    items    : [
        {
            type: 'checkbox',
            icon : 'b-fw-icon b-icon-add',
            text : 'Add',
            onClick: (evData) => {
              console.log('click', evData)
              // filter the resource store
            }
        },
    ]
});

new Button({
    appendTo : document.body,
    cls      : 'b-raised',
    text     : 'Show menu',
    menu
});

and inside that onClick, you can filter the resourceStore using this function https://bryntum.com/products/scheduler/docs/api/Scheduler/data/ResourceStore#function-addFilter

Best regards,
Márcio


Post by burnit »

Hi Márcio,

how can i access the resourceStore?
My console.log of scheduler.resourceStore tells me undefined.
My console.log of scheduler shows me an object, starting with current.
There can i find the ressourceStore under schedulerPro.current.schedulerProInstance._resourceStore
But is this the correct way to access it?


Post by marcio »

Hey burnit,

You can access directly using schedulerpro.current.instance.resourceStore.

Props that are marked with _ are private and are not recommended to be used, only the available ones in the public API.

Best regards,
Márcio


Post by burnit »

Working! Many thanks!

But i have another problem with the menu button.

Please have a look.

 <BryntumButton
        text={'Maschinen auswählen'}
        menu={[
          {
            text: '1010',
            checked: false,
          },{
            text: '1020',
            checked: false,
          },{
            text: '1030',
            checked: false,
          },{
            text: '1040',
            checked: false,
          },{
            text: '1050',
            checked: false,
          },
        ]}
      ></BryntumButton>

When i use this one, then i get an console error

Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at _spb (schedulerpro.module.js:53:1)
    at bW (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)
    at Menu.set (schedulerpro.module.js:10:1)

Post by burnit »

Got it!
Solution:

<BryntumButton
        text={'Maschinen auswählen'}
        menu={{
          items: [
          {
            text: '1010',
            checked: false,
          },{
            text: '1020',
            checked: false,
          },{
            text: '1030',
            checked: false,
          },{
            text: '1040',
            checked: false,
          },{
            text: '1050',
            checked: false,
          },
        ]}}
      ></BryntumButton>

Post by marcio »

Hey burnit,

Which version are you using? In the latest (5.2.9) I tested this one and worked just fine (check the video attached)

<BryntumButton
        text={'Maschinen auswählen'}
        menu={[
          {
            text: '1010',
            checked: false,
          },{
            text: '1020',
            checked: false,
          },{
            text: '1030',
            checked: false,
          },{
            text: '1040',
            checked: false,
          },{
            text: '1050',
            checked: false,
          },
        ]}
      ></BryntumButton>
Attachments
Bryntum Scheduler Pro - Inline data demo (React) - 2 February 2023.mp4
(130.39 KiB) Downloaded 16 times

Best regards,
Márcio


Post by burnit »

Hi Márcio,

when i add an filter to the ressourceStore.
How can i get information about if a ressource is filtered out or not?

Background: I want to have a checkbox. The checkbox should be unchecked if the resource is filtered out, and checked if not



Post by burnit »

Hi alex,

i need to know, which resource is filtered. Is there any way?
a general information about if the resource store is filteres is not needed.

Greetings,
André


Post Reply