PrimeFaces v2.2.1的时间表:转到特定日期

时间:2021-07-13 14:33:53

I want to have a feature such that when the user clicks on a Date, the calendar will render the agendaDay view of that Date. I tried as following:

我希望有一个功能,当用户点击日期时,日历将呈现该日期的agendaDay视图。我尝试如下:

<p:schedule id="timetable" widgetVar="mySchedule" editable="true"
    allDaySlot="false" value="#{cc.attrs.managedBean.eventModel}" 
    dateSelectListener="#{mrBean.onDateSelect}" 
    onDateSelectUpdate="timetable" 
    initialDate="#{mrBean.initialDate}"
    view="#{mrBean.view}">
</p:schedule>

And this is my ManagedBean:

这是我的ManagedBean:

@Named(value = "mrBean")
@RequestScoped
public class MrBean {
    private ScheduleModel eventModel;
    private String        view;
    private Date          initialDate;

    public MrBean() {
        eventModel = new DefaultScheduleModel();
    }

    public void onDateSelect(DateSelectEvent selectEvent) {
        view        = "agendaDay";
        initialDate = selectEvent.getDate();
    } 

    // Getters and Setters 
} 

When I try to click on a Date, the whole calendar disappeared and I saw this string {"events" : []} on the browser.

当我尝试点击日期时,整个日历消失了,我在浏览器上看到了这个字符串{“events”:[]}。

I'd be very grateful if someone could show me where I have done wrong.

如果有人能告诉我我做错了什么,我将非常感激。

Best regards,

James Tran

2 个解决方案

#1


0  

http://forum.primefaces.org/viewtopic.php?f=3&t=1949

This sums it up nicely. It is used for the initial load, but beyond that it isn't functional. You can look to 3.0M4 which has a new model (and better model) for the schedule or you can do something sneaky like override the FC Calendar it is built on

这总结得很好。它用于初始加载,但除此之外它不起作用。您可以查看3.0M4,它有一个新模型(和更好的模型)的日程安排或你可以做一些偷偷摸摸的事情,如覆盖它建立在它上面的FC日历

http://www.planbox.com/blog/development/coding/full-calendar-jquery-widget-simply-awesome.html

via the "widgetVar" attribute so that when you fire a particular click it switches views. To be honest, that's probably faster as well as it would happen client side and it already has all the data.

通过“widgetVar”属性,以便当您触发特定的单击时,它会切换视图。说实话,这可能更快,而且它会发生在客户端,它已经拥有了所有数据。

#2


0  

I have tried this one! I was successful only through the attribute view="agendaDay" in the schedule Tag, else we will not come to know exactly whether the date given by us has been selected or not.

我试过这个!我只是通过计划标签中的属性view =“agendaDay”成功,否则我们不会确切地知道我们给出的日期是否已被选中。

#1


0  

http://forum.primefaces.org/viewtopic.php?f=3&t=1949

This sums it up nicely. It is used for the initial load, but beyond that it isn't functional. You can look to 3.0M4 which has a new model (and better model) for the schedule or you can do something sneaky like override the FC Calendar it is built on

这总结得很好。它用于初始加载,但除此之外它不起作用。您可以查看3.0M4,它有一个新模型(和更好的模型)的日程安排或你可以做一些偷偷摸摸的事情,如覆盖它建立在它上面的FC日历

http://www.planbox.com/blog/development/coding/full-calendar-jquery-widget-simply-awesome.html

via the "widgetVar" attribute so that when you fire a particular click it switches views. To be honest, that's probably faster as well as it would happen client side and it already has all the data.

通过“widgetVar”属性,以便当您触发特定的单击时,它会切换视图。说实话,这可能更快,而且它会发生在客户端,它已经拥有了所有数据。

#2


0  

I have tried this one! I was successful only through the attribute view="agendaDay" in the schedule Tag, else we will not come to know exactly whether the date given by us has been selected or not.

我试过这个!我只是通过计划标签中的属性view =“agendaDay”成功,否则我们不会确切地知道我们给出的日期是否已被选中。