简体   繁体   English

全日历。 如果我隐藏了月份视图并导航到上个月,我该如何将事件重新呈现到它们的理想位置

[英]fullcalendar. If I hide month view and navigate to previous month, how could I rerender events to their perfect place

I have another self-defined agenda view. 我有另一个自定义的议程视图。 If the user clicks on button agenda, then, original view will be hidden. 如果用户单击按钮议程,则原始视图将被隐藏。 When the user navigate month, I have ajax call to get event data. 当用户浏览月份时,我有一个ajax调用来获取事件数据。 On normal view, events are showing perfect. 正常情况下,事件显示完美。 After I hide the normal view and use my agenda view, when the user wants to go back to normal month view, all event are squeezed to left side. 当我隐藏普通视图并使用议程视图后,当用户想要返回普通月视图时,所有事件都被压缩到左侧。 So, my question is How do I have event render properly when I call $(element).show() and where is right place to do it? 所以,我的问题是,当我调用$(element).show()时,如何正确渲染事件?在哪里正确进行渲染?

I know it's over a year old, but I'll answer this because I came up with the same issue. 我知道已经有一年了,但是我会回答这个问题,因为我也遇到了同样的问题。

You need to set the fc-view-month, agendaWeek and agendaDays to visibility - hidden with CSS and also height to 1px. 您需要将fc-view-month,archiveWeek和scheduleDays设置为可见性-隐藏在CSS中,并将高度设置为1px。

$('.fc-view-month').height('1px').css('visibility', 'hidden');

Then show your agenda List view. 然后显示您的议程列表视图。

I tried quite a few of the methods that fullcalendar has and although it drew the events, they were shifted to the left. 我尝试了fullcalendar拥有的许多方法,尽管它吸引了事件,但它们却移到了左侧。 Probably due to not being able to find where the calendar dates are as the view is hidden by hide(). 可能是由于由于hide()隐藏了视图,因此无法找到日历日期在哪里。 Setting the views to visibility - hidden means it can still see the calendar date. 将视图设置为可见性-隐藏意味着它仍然可以看到日历日期。

Hope this is helpful to someone :) 希望这对某人有帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM