点击外部日历时,点击fullcalendar fire eventclick [英] fullcalendar fire eventclick when click outside calendar

查看:521
本文介绍了点击外部日历时,点击fullcalendar fire eventclick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个活动日的列表。当我点击列表中的事件时,我想要点击日历上的相同动作。我的eventClick函数:

  eventClick:function(calEvent,jsEvent,view){
openEvent(calEvent);
}


解决方案

试试这个。为您的活动分配一些ID。然后,在eventRender事件中,将此ID添加到事件div。注意,还有eventClick处理程序存在:

  $('#calendar')。fullCalendar({
header:{
left:'prev,next today',
center:'title',
right:'month,basicWeek,basicDay'
},
defaultDate:'2016 -09-12',
navLinks:true,//可以点击日/星期的名称以浏览视图
editable:true,
eventLimit:true,//同时允许更多链接许多活动
events:[
{
title:'Meeting',
start:'2016-09-12T10:30:00',
end:'2016 -09-12T12:30:00',
id:1234
}
],
eventRender:function(event,element,view){
element .find('.fc-content').attr(id,event-+ event.id);
},
eventClick:function(event,jsEvent,view){
alert(event.id);
},
});

然后在事件列表点击后调用它:

  $( '#事件1234.fc内容')的触发器( '点击'); 

您可以在此尝试:

http://jsbin.com/fejifovuxo/edit?js,output



祝你好运!


I have a list of event days. When I click on the event in the list I want to fire the same action like I click on calendar. My eventClick function:

eventClick: function(calEvent, jsEvent, view) {
 openEvent(calEvent);
}

解决方案

Try this. Assign some id to your event. Then, in eventRender event, add this id to the event div. Note there is also eventClick handler present:

$('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
        },
        defaultDate: '2016-09-12',
        navLinks: true, // can click day/week names to navigate views
        editable: true,
        eventLimit: true, // allow "more" link when too many events
        events: [
            {
                title: 'Meeting',
                start: '2016-09-12T10:30:00',
                end: '2016-09-12T12:30:00',
                id: "1234"
            }
        ],
        eventRender: function (event, element, view) {
            element.find('.fc-content').attr("id", "event-" + event.id);
        },
        eventClick: function (event, jsEvent, view) {
            alert(event.id);
        },
    });

Then call this after your events list click:

$('#event-1234.fc-content').trigger('click');

You can try it here:

http://jsbin.com/fejifovuxo/edit?js,output

Good luck!

这篇关于点击外部日历时,点击fullcalendar fire eventclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆