FullCalendar.js:渲染带时间标签的背景? [英] FullCalendar.js: Rendering background with time labels?

查看:180
本文介绍了FullCalendar.js:渲染带时间标签的背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用回调。

  eventRender:function(event,element,view){
if(event.rendering ===background){
//只需在事件元素中添加一些文本或html。
element.append(event.start.format('HH:mm')+ - +
event.end.format('HH:mm'));
}
},

你当然可以添加一个或两个if你需要更好的格式。



这是一个 JSFiddle 使用它(使用与您的其他问题相同的基本代码)


I am starting to use Fullcalendar and love the docs. However, I am stuck with the following problem:

Rendering background with time labels?

I have one user specifying his available times, and another user who can do a selection out of those given times. To allow selection we need to set rendering: 'background' in the events array, otherwise the main event is blocking the event insert. But when using background rendering the time labels disappear:

So how can I tell Fullcalendar to keep on displaying those time labels even in background rendering mode?


I would be happy if somebody could help me out.

解决方案

Adding time labels to background events doesn't come "out of the box" but it's easy enough to do with the eventRender callback.

eventRender: function(event, element, view ){
    if(event.rendering === "background"){
        // Just add some text or html to the event element.
        element.append( event.start.format('HH:mm') + " - " + 
                       event.end.format('HH:mm'));
    }
},

You can of course add a span or two if you want better formatting.

Here's a JSFiddle with it working (Using the same base code as your other question)

这篇关于FullCalendar.js:渲染带时间标签的背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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