how to focus on event schedule?

UI Components for JSF
ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

04 Mar 2010, 09:22

Hi,

I want to display the certain month to be displayed for a certain event. Is this possible?

Thanks Tai

ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

04 Mar 2010, 12:15

Or is there a possibility to move the schedule view to a certain date?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 16:16

You can use the initialDate attribute.

ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

04 Mar 2010, 19:02

And how can I programmatically set this attribute? In my back bean I only have the the ScheduleModel and the events. How can I get the Schedule itself?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Mar 2010, 19:07

You can bind any date to initialDate;

Code: Select all

<p:schedule initialDate="#{bean.date}" .../>

ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

04 Mar 2010, 22:27

Yes. Understood. But I assume this attribute is set only once, correct? But I want this programmatically set in my class (and not in my xhtml). This allows me to set the schedule's inital date every time when a new event is added.
Currently when I update the view then the schedule always jumps to "now". Maybe when setting the inital date is set on a refresh it always jumps the this date. But I want to set the inital date to the latest event.

ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

05 Mar 2010, 12:39

I tried the following to remember the last event select by using the attribute eventSelectListener="#{productionScheduleBean.onEventSelect}":

Code: Select all

    public void onEventSelect(ScheduleEntrySelectEvent selectEvent) {
....
            Schedule schedule = (Schedule) selectEvent.getSource();
            schedule.setInitialDate(productionRun.getProductionStart());
            FacesContext.getCurrentInstance().renderResponse();
        }
    }
Unfortunately that doesn't work. On a refresh the schedule still jumps to "now".

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Mar 2010, 13:09

Do you refresh the whole page, initialDate only works when page is refreshed, for ajax it would not work.

ttruong
Posts: 109
Joined: 01 Mar 2010, 12:50

05 Mar 2010, 15:10

Programmatical update of the initial date is too complicated. Since the schedule handling e.g. in the onEventSelect() contains an old schedule (I assume Schedule is new created when rendering is done):

Schedule schedule = (Schedule) selectEvent.getSource(); //returns an old schedule

The easiest way is really to use the attribute in the facelet:
initialDate="#{productionScheduleBean.currentProductionStart}"

That Works for me.

Thanks Tai

PuppaLutta
Posts: 1
Joined: 02 Jan 2017, 10:25

20 Jan 2017, 16:36

How can I highlight the initialDate on monthview?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 37 guests