【问题标题】:enable/disable specific dates [duplicate]启用/禁用特定日期
【发布时间】:2011-07-16 07:36:28
【问题描述】:

可能重复:
Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?

我将从数据库中获取一组日期。我只需要在 jQuery 日历中启用那些日期。我该怎么做?

【问题讨论】:

  • 嗨,我们都想帮助你,但你必须先尝试一些代码,把它贴在这里,也许在你在的时候接受你以前问题的一些答案它:)
  • 您介意告诉您您使用的是什么日历吗?

标签: jquery calendar


【解决方案1】:

【讨论】:

    【解决方案2】:

    你可以使用这个利用 jQuery-UI 日期选择器的 jQuery 插件

    http://balupton.com/sandbox/jquery-sparkle/demo/#eventcalendar

    只需查询您的数据库并以这种格式返回一个 JSON 对象

    {
        "entries": [
            {
                "id": 1,
                "title": "My First Entry",
                "start": "2010-07-14 11:11:00",
                "finish": "2010-07-14 14:23:18",
                "user": {
                    "name": "Joe"
                }
            },
            {
                "id": 2,
                "title": "My Second Entry",
                "start": "2010-07-14 11:11:00",
                "finish": "2010-07-15 14:23:18",
                "user": {
                    "name": "Joe"
                }
            }
        ]
    }
    

    然后将其作为选项添加到插件中:

    $eventCal.EventCalendar({
            // Ajax Variables
            /** The JSON variable that will be return on the AJAX request which will contain our entries */
            ajaxEntriesVariable: 'entries',
            /** The AJAX url to request for our entries */
            ajaxEntriesUrl: './eventcalendar.json'
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-04
      • 2017-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-02
      • 2010-10-15
      相关资源
      最近更新 更多