[英]Get events clicking a day in FullCalendar
I want to know if is possible to get a list or array or something with events of one day by clicking that day in fullcalendar.我想知道是否可以通过在 fullcalendar 中单击那天来获取列表或数组或某天的事件。
Now I get the events from google calendar, if I need to make a query each time I want to get events of one day, it will be so hard for connections.现在我从谷歌日历中获取事件,如果每次我想获取某一天的事件时都需要进行查询,那么连接将非常困难。 I guess it has to be possible since you already have the events for rendering them.我想它必须是可能的,因为你已经有了渲染它们的事件。
One user ask me for code:一位用户向我索要代码:
dayClick: function(date, allDay, jsEvent, view) {
console.log(date);
console.log(allDay);
console.log(jsEvent);
console.log(view);
if (allDay) {
// alert('Clicked on the entire day: ' + jsEvent);
}
},
eventClick: function(event) {
if (event.url) {
return false;
}
}
I can't understand why someone voted me negative.我不明白为什么有人给我投了反对票。 I made a question, someone ask for code, I put code but I EXPLAINED why I have no more code, and -1 vote?我提出了一个问题,有人要求提供代码,我放了代码但我解释了为什么我没有更多代码,并且 -1 投票? I can't understand it.我无法理解。
I think you could do something like我想你可以做类似的事情
dayClick: function(date, allDay, jsEvent, view) {
var dayEvents = $('yourSelector').fullCalendar( 'clientEvents' function(event){
return event.start.setHours(0, 0, 0, 0) === date.setHours(0, 0, 0, 0);
//or some way to compare that is the same day
//I recommend momentjs lib ex moment(event.start).isSame(date,'day')
});
}
What I suggest is to query the client events and filter it checking if its the same day我的建议是查询客户端事件并过滤它检查它是否在同一天
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.