Reputation: 288
I'm using fullcalendar v2.0.2 and I'm making a copy/paste system for event. I can copy the event on right clicking with a little menu.
When I do a right click on the calendar, if it's a week, I calculate the position of each .fc-agenda-days tr td
and .fc-agenda-slots tr
. I have to add the vertical + horizontal scroll, get the slot duration, start date of current view ... It's a lot of stuff to consider, I can have a specific case maybe...
I searched into the documentation for a helper, but I didn't find it... And I looked in the source code without success.
My question is : "Is there an helper or a method for getting a date with a position or event ?"
Edit, I think I've found a way to do it, but it doesn't work :
{
_pasteEventMenu: function(e, scope){
var that = this;
var date = null;
var view = this._call('getView');
var hoverListener = view.getHoverListener();
hoverListener.start(function(coordinates){
console.log('a', coordinates);
console.log('Right click on ', view.cellToDate(coordinates).format('MMMM Do YYYY, hh:mm:ss'));
}, e);
hoverListener.stop();
console.log('HERE');
}
}
this code product the following out when I click on Monday October 13rd at 10:04 AM
a Object {row: 61, col: 0}
Right click on december 14 2015, 12:00:00
HERE
Upvotes: 0
Views: 581
Reputation: 288
I finally find a trick, if someone want it :
var that = this;
var date = null;
var view = this._call('getView');
var hoverListener = view.getHoverListener();
hoverListener.start(function(coordinates){
console.log('a', coordinates);
var sec = (view.getMinTime()._milliseconds / 1000) + coordinates.row * (view.getSlotDuration()._milliseconds / 1000);
console.log('Right click on ', view.cellToDate(0, coordinates.col).add(sec, 'seconds').format('MMMM Do YYYY, HH:mm:ss'));
}, e, 'contextmenu');
hoverListener.stop();
console.log('HERE');
Upvotes: 1