Discuss anything related to web development but no technical support questions


Post by lxxrxns »

Hey,

Because my events in my Scheduler almost fill the entire row, it can sometimes be hard to click above or below an existing event in order to add another event.

What I would like is to add an option to the right-mouse context menu that says: "Add another event" (for the date that is clicked).

Image

Clicking this option would open the Edit Event box that is also opened when you choose "Add event" from the right-mouse context menu when clicking an empty space.

Thanks for the help!

Laurens

Last edited by lxxrxns on Mon Aug 14, 2023 9:34 am, edited 2 times in total.

Post by tasnim »

Hi,

To not have any confusion, Which bryntum product are you using?


Post by lxxrxns »

Hi tasnim,

Scheduler! Sorry! Updated question for clarity.

Laurens


Post by Animal »

See this example on how to modify the event context menu: https://bryntum.com/products/scheduler/examples/eventmenu/

Screenshot 2023-08-14 at 09.39.52.png
Screenshot 2023-08-14 at 09.39.52.png (902.23 KiB) Viewed 1658 times

Full API docs for that feature here: https://bryntum.com/products/scheduler/docs/#Scheduler/feature/EventMenu


Post by lxxrxns »

Thanks for the info!

I'm having trouble to open the Event Editor for a new event on the date that is clicked though (because the event may span multiple days).

Could you point me into the right direction on how to open the Event Editor for a new event with the date set to the date that is right-clicked?

Thanks so much for the help!


Post by tasnim »

Hi,

You could use https://bryntum.com/products/scheduler/docs/api/Scheduler/view/SchedulerBase#function-createEvent and https://bryntum.com/products/scheduler/docs/api/Scheduler/view/mixin/TimelineDateMapper#function-getDateFromDomEvent methods to achieve this

    features : {
        eventMenu : {
            items : {
                addAnotherEvent : {
                    text : 'Add Another Event',
                    onItem(props) {
                        const { source, resourceRecord, event } = props;
                        source.createEvent(source.getDateFromDomEvent(event), resourceRecord);
                    }
                }
            }
        }
    }

And this is the result

chrome_QKZfe7tikK.gif
chrome_QKZfe7tikK.gif (643.94 KiB) Viewed 1654 times

Post by lxxrxns »

Wow, thanks, this looks so cool!

I'm on an older version of Scheduler though (version 4; still have to upgrade...) but this gives me an error: source.createEvent is not a function. Do you happen to know if the createEvent function used to be called something else back in version 4? I can't find the old docs anymore...

Thanks a lot!


Post by tasnim »

Hi,

Seems like there was no function called createEvent at version 4
https://bryntum.com/products/scheduler/docs/api/apidiff

Screenshot 2023-08-14 172324.png
Screenshot 2023-08-14 172324.png (22.48 KiB) Viewed 1626 times

I would recommend you upgrade to the latest version where you would get lots of bug fixed and improvements


Post by lxxrxns »

Hi tasnim

Thanks a lot for figuring this out.
I am considering to upgrade but since I have modified so much in the script it will be a huge task to upgrade while keeping the same functionality with all the modifications I have made.

Do you know if, for now, there would be another way to trigger the Event Editor in v4 (because when I right click on an empty space, there is an option "Add event" and this actually works (the scheduleMenu item "addEvent" works just fine), so it should be possible...)

Thanks anyways for your help!

Laurens


Post by tasnim »

Then you could add an event in the old fashion way by eventStore.add(record)
https://bryntum.com/products/scheduler/docs/api/Scheduler/data/EventStore#function-add (assign the resource id to the record)
And then you could use https://bryntum.com/products/scheduler/docs/api/Scheduler/feature/EventEdit#function-editEvent to open the editor after creating it.

Hopefull this would help.


Post Reply