How to add resources to the scheduler?

Show cool things you have done with our products
Post Reply
User avatar
William
Posts: 9
Joined: Tue Aug 13, 2019 8:30 am

How to add resources to the scheduler?

Post by William » Tue Aug 13, 2019 8:38 am

How to add resources to the scheduler?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2242
Joined: Fri Apr 01, 2016 11:08 am

Re: Scheduler

Post by pmiklashevich » Tue Aug 13, 2019 8:44 am

Please see our docs & guides: https://www.bryntum.com/docs/scheduler/#guides/data/storebasics.md

Code: Select all

scheduler.resourceStore.add({ name : 'Scarlet Witch' });
P.S. Please pick out correct forum next time (Bryntum Scheduler)
Pavel Miklashevich - Core Developer

User avatar
William
Posts: 9
Joined: Tue Aug 13, 2019 8:30 am

Re: How to add resources to the scheduler?

Post by William » Tue Aug 13, 2019 8:50 am

Can you add resources with mouse click on the web page?

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2242
Joined: Fri Apr 01, 2016 11:08 am

Re: How to add resources to the scheduler?

Post by pmiklashevich » Tue Aug 13, 2019 9:24 am

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:

Code: Select all

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:

Code: Select all

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' });
                }
            }]
        }
    },
Pavel Miklashevich - Core Developer

User avatar
William
Posts: 9
Joined: Tue Aug 13, 2019 8:30 am

Re: How to add resources to the scheduler?

Post by William » Tue Aug 13, 2019 10:19 am

Good advice, thank you !

Post Reply