Page 1 of 1

How to add resources to the scheduler?

Posted: Tue Aug 13, 2019 8:38 am
by William
How to add resources to the scheduler?

Re: Scheduler

Posted: Tue Aug 13, 2019 8:44 am
by pmiklashevich
Please see our docs & guides: https://www.bryntum.com/docs/scheduler/#guides/data/storebasics.md
scheduler.resourceStore.add({ name : 'Scarlet Witch' });
P.S. Please pick out correct forum next time (Bryntum Scheduler)

Re: How to add resources to the scheduler?

Posted: Tue Aug 13, 2019 8:50 am
by William
Can you add resources with mouse click on the web page?

Re: How to add resources to the scheduler?

Posted: Tue Aug 13, 2019 9:24 am
by pmiklashevich
It's not supported out of the box, but can be easily implemented. You just need a button, a contextmenu item, or listen to a click/dbclick.

For example, cellClick event:
let scheduler = new Scheduler({
    listeners : {
        cellClick : () => {
            scheduler.resourceStore.add({ name : 'New resource' });
        }
    },
But I would recommend to use a context menu, because cellClick/scheduleClick/cellDblClick/scheduleDblClick may interfere with some built-in features, for example:
let scheduler = new Scheduler({
    features : {
        contextMenu : {
            cellItems : [{
                text   : 'Add new resource',
                icon   : 'b-fa b-fa-plus',
                weight : 200,
                onItem : () => {
                    scheduler.resourceStore.add({ name : 'New resource' });
                }
            }]
        }
    },

Re: How to add resources to the scheduler?

Posted: Tue Aug 13, 2019 10:19 am
by William
Good advice, thank you !