Wdatepicker Calendar Add event, handle date event on any month change

Source: Internet
Author: User
original by

When making a system, it is sometimes necessary to block out certain special dates, such as Sunday or statutory holidays, as well as the dates of some shifts; the use of Wdatepicker can shield off Sunday and most statutory holidays, but it is not easy to deal with the days like qingming or shift. Idea

1: The calendar is not limited, but when selected to validate the selected date (using the onpicking event), do not meet the Cancel

The advantage is that the implementation is simple, the disadvantage is that the calendar is not marked, need to point to know is not allowed


2: When the binding time to initialize a calendar, the month of change also processing a calendar, the date of the non-conforming to special treatment

The advantage is that the user will know what is available and what is not difficult when they use it:

Wdatepicker first binding and then change the parameters will not be updated, and what other dates are required to deal with is not possible in the binding date is all set down, to be dynamically obtained when the month changes, then also can not pass the calendar with the parameters to deal with (changed the parameters are not used) to solve:

Since the calendar is loaded and can be processed through the DOM, then the generated calendar is processed directly

Processed once after loading and processed once every time the month is changed (this example sets Wdatepicker's parameter $crossFrame to false to simplify the DOM structure)

In the example, the date of all multiples of 3 is changed, and the click event changes, and the effect is as follows:


The code is relatively simple:

<! DOCTYPE html>  


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.