loklok
loklok

Reputation: 79

Richfaces Calendar Today Date

I am trying to change the "today" date in richfaces calendar module. I could not find anything in the CalendarDataModel provided by richfaces thus im trying to find the answer here. I am not talking about the selected date.

Use Case:

Wider explanation:

Thank you for any suggestions.

Upvotes: 0

Views: 544

Answers (1)

Vasil Lukach
Vasil Lukach

Reputation: 3728

Following code sets date from first calendar to second and rerender second calendar component. Code not sets today date for second calendar. System date is used as today date and it is the same date for first and second calendars. Code:

    <h:panelGrid columns="2">
        <h:outputLabel for="from" value="From" />
        <rich:calendar id="from" value="#{t1Calendar.from}"
            datePattern="dd/MM/yyyy" enableManualInput="true">
            <a4j:ajax event="change" render="to"/>
        </rich:calendar>

        <h:outputLabel for="to" value="To" />
        <rich:calendar id="to" value="#{t1Calendar.to}"
            datePattern="dd/MM/yyyy" enableManualInput="true" popup="true"/>
    </h:panelGrid>

and

@ManagedBean
public class T1Calendar {
    private Date from = new Date();
    private Date to;

    public Date getFrom() { return from; }
    public void setFrom(Date from) {
        this.from = from;
        this.to = from;
    }
    public Date getTo() { return to; }
    public void setTo(Date to) { this.to = to; }

}

Upvotes: 1

Related Questions