【问题标题】:disable days in rich faces 4 calendar component禁用富面 4 日历组件中的天数
【发布时间】:2012-10-20 15:27:25
【问题描述】:

我使用两个 ric:calendar 一个作为开始日期,另一个作为结束日期。

结束日期应根据开始日期选择自动禁用所有以前的日期。

是否可以使用dayDisableClass?

【问题讨论】:

  • 这是一个分步示例,向您展示如何突出显示和禁用某些日子。 tech-lead.blogspot.com/2012/10/… 看起来可能有点复杂。但它并没有那么困难。注意modelItem.setEnabled(true);这行代码。

标签: jsf-2 richfaces


【解决方案1】:

您可以使用日历的属性 dayDisableFunction 并定义您的 JavaScript 函数,该函数将定义哪些天被禁用:

<rich:calendar dayDisableFunction="disablementFunction" ...</rich:calendar>

示例 JS 函数:

function disablementFunction(day) {
    if (day.isWeekend) return false;
    return true;
}

【讨论】:

    【解决方案2】:

    disabledDay 的方式重新考虑...

    看看这个帖子:Disable days on rich:Calendar

    你也可以使用日历CalendarDataModel -> CalendarDataModelItem -> isEnabled()

    Boolean isEnabled() returns "true" if date is "selectable" on the calendar, the default implementation returns "true"
    

    看看Demo

    【讨论】:

    猜你喜欢
    • 2022-01-25
    • 2013-06-11
    • 1970-01-01
    • 2011-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-26
    相关资源
    最近更新 更多