How to detect a click on a background event when two or more background events are on the same row in month view?

白昼怎懂夜的黑 提交于 2019-12-19 09:16:13

问题


Can't seem to find an answer to this - so thought I'd give this a shot.

I have read several answers on how to detect a click of a background event. Such as this: Detect click on background event

What I've found, however, is that when two ore more background events are on the same row, only the last day rendered as a background event will contain the proper CSS target to allow detection. All the previous days on that row (month view is what I'm working in) will act as regular "dayClick" events, even though they are actually rendered as background events.

For example, in this image, clicking on the 25th is detected, while clicking on that 22nd is not:

Looking at the source of the page, the first three days (the 22nd through the 24th) all appear in this image on the line marked "1". It's a TD with a colspan of 3. The line marked "2" is the line that has the TD containing the 25th:

Effectively anything before the 25th is cut off from being targeted using fc-bgevent.

It should be noted that a single background event that spans days works as expected. So if I was to simply extend the end date of the event that starts on the 22nd to the 25th, it will all work - except of course the "start" date that you receive in the click event will be the 22nd, no matter which day you click on.

Has anyone found a way around this?

What I want to do is render background events and also detect the date when they are clicked.

Thanks, in advance, for the help.


回答1:


Use selectOverlap to detect click on background events

selectOverlap: function(event) {
    // Here you will get all background events which are on same time.
    console.log(event);
    return event.rendering === 'background';
}


来源:https://stackoverflow.com/questions/35426002/how-to-detect-a-click-on-a-background-event-when-two-or-more-background-events-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!