Getting specific hour on timeaxiscolumn

Support for v6.x of our Scheduling components
Post Reply
User avatar
Hakim
Posts: 29
Joined: Fri Apr 26, 2019 3:00 pm

Getting specific hour on timeaxiscolumn

Post by Hakim » Wed Jul 10, 2019 11:13 am

In hourAndDay presetView, one can see |0:00| , |1:00|, ..., |23:00|. Let say one wants to add an event on a right click action. How to get the particular time in the column one clicks on? For instance, I would like to add an event and the timeaxis of my click action is |1: 00|. How do I get that 1:00? I used the debugger but I could not get it. Please, any idea on how to get that time ?
Thanks

User avatar
mats
Core Developer
Core Developer
Posts: 14801
Joined: Sat Dec 19, 2009 11:41 pm
Location: Sweden
Contact:

Re: Getting specific hour on timeaxiscolumn

Post by mats » Wed Jul 10, 2019 8:37 pm

Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog

@bryntum
Facebook
API documentation

User avatar
Hakim
Posts: 29
Joined: Fri Apr 26, 2019 3:00 pm

Re: Getting specific hour on timeaxiscolumn

Post by Hakim » Thu Jul 11, 2019 4:41 pm

Thanks mats,
Unfortunately, the API you proposed does not seem to solve the problem

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

Re: Getting specific hour on timeaxiscolumn

Post by pmiklashevich » Thu Jul 11, 2019 5:09 pm

Adding events from schedule context menu works out of the box.
Снимок экрана 2019-07-11 в 18.10.44.png
Снимок экрана 2019-07-11 в 18.10.44.png (46.19 KiB) Viewed 270 times
To turn it off you can configure context menu feature

Code: Select all

const scheduler = new Scheduler({
    features : {
        scheduleContextMenu : {
            items : {
                addEvent : false
            }
        }
    }
});
See details here: https://www.bryntum.com/docs/scheduler/#Scheduler/feature/ScheduleContextMenu

When you subscribe to scheduleContextMenu `date` is already in the params, so you don't need even to retrieve it out of the click event.

Code: Select all

scheduler.on({ scheduleContextMenu : ({date}) => { console.log(date) } })
Pavel Miklashevich - Core Developer

User avatar
Hakim
Posts: 29
Joined: Fri Apr 26, 2019 3:00 pm

Re: Getting specific hour on timeaxiscolumn

Post by Hakim » Fri Jul 12, 2019 3:23 pm

Can we get the specific time from this method? That was my aim whenever one right-clicks

Code: Select all

schedulecontextmenu: function(scheduler,  clickedDate, rowIndex, e, eOpts){}

User avatar
Hakim
Posts: 29
Joined: Fri Apr 26, 2019 3:00 pm

Re: Getting specific hour on timeaxiscolumn

Post by Hakim » Fri Jul 12, 2019 3:30 pm

with this

Code: Select all

scheduler.timeAxisViewModel.columnConfig
, one can see all times, but I need to get the one I click on only

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

Re: Getting specific hour on timeaxiscolumn

Post by pmiklashevich » Fri Jul 12, 2019 8:30 pm

Please learn the docs: https://www.bryntum.com/docs/scheduler/#Scheduler/view/mixin/SchedulerDomEvents#event-scheduleContextMenu
Please open https://www.bryntum.com/examples/scheduler/basic/ and run this code in a browser console:

Code: Select all

scheduler.on({
    scheduleContextMenu : function (args) {
        console.log(args);
    }
});
Then rightclick the scheduler timeline. See what params are coming to the handler in the console.
Pavel Miklashevich - Core Developer

User avatar
Hakim
Posts: 29
Joined: Fri Apr 26, 2019 3:00 pm

Re: Getting specific hour on timeaxiscolumn

Post by Hakim » Sat Jul 13, 2019 8:54 am

Thank you
pmiklashevich
. That's so helpful :-)

Post Reply