Display Resource Name in Event

北城以北 提交于 2019-12-13 05:54:57

问题


I'm trying out the new Scheduler add-on for FullCalendar. I've got it all working great, but I hoped there'd be a property I could add to an Event object so that it would display the name of the Resource it's associated with as well as the Title, but there doesn't seem to be. Is there a way in which this could be done?

The goal is for Events displayed in a standard calendar view (e.g. agendaWeek) to show the time and Title (as they do now) as well as the Resource Name.


回答1:


Easy enough to do with the eventRender callback.

eventRender:function( event, element, view ) {
    $(element).find(".fc-content").append("<div>"+event.resourceId+"</div>");
}

JSFiddle

If you want, say the title of the resource instead of the ID, use the getResourceById method too.

eventRender:function( event, element, view ) {
    var resource = $("#calendar").fullCalendar("getResourceById","1");
    $(element).find(".fc-content").append("<div>"+resource.title+"</div>");
}

JSFiddle



来源:https://stackoverflow.com/questions/32136762/display-resource-name-in-event

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