在FullCalendar中点击一天的活动 [英] Get events clicking a day in FullCalendar
问题描述
现在我得到了事件从谷歌日历中,如果每次我想要获取某天的事件时都需要查询,则连接将会非常困难。我猜它必须是可能的,因为你已经有了渲染它们的事件。
一位用户向我索要代码:
dayClick:function(date,allDay,jsEvent,view){
console.log(date);
console.log(allDay);
console.log(jsEvent);
console.log(view);
if(allDay){
// alert('点击整天:'+ jsEvent);
$ b},
eventClick:function(event){
if(event.url){
return假;
code
$ b我无法理解为什么有人投我的反面意见。我提出了一个问题,有人要求输入代码,我输入了代码,但我解释了为什么我没有更多的代码,并且-1票?我无法理解它。解决方案我认为你可以做类似于
$ b $ (日期,allDay,jsEvent,视图){
var dayEvents = $('yourSelector')。fullCalendar('clientEvents'function(event){$ b pre $ dayClick
return event.start.setHours(0,0,0,0)=== date.setHours(0,0,0,0);
//或者某种比较方式相同day
//我推荐momentjs lib ex moment(event.start).isSame(date,'day')
});
}
我建议查询客户端事件并过滤它是否检查同一天
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.
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? 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
这篇关于在FullCalendar中点击一天的活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!