How to operate the calendar range selection plug-in
Jun 08, 2018 am 10:44 AMThis time I will show you how to operate the calendar range selection plug-in, and what are the precautions for operating the calendar range selection plug-in. The following is a practical case, let's take a look.
Daterangepicker is a calendar plug-in for bootstrap that is mainly used to select a time period. This plug-in is very easy to use and easy to operate.
Introducing related plug-ins
1 2 3 4 5 6 7 |
|
Add the calling method of the plug-in to the required elements:
1 |
|
You can customize related configurations through parameters, and you can also use callback functions in the user Get notified when you select a new date.
1 2 3 4 5 6 7 8 9 10 |
|
These configurations can be composed into a configuration file and then introduced in ()
1 |
|
Configuration file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Configuration options, methods and events
Configuration Options
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
Methods
You can update the date picker programmatically using the setStartDate and setEndDate methods startDate and endDate in . You can also access the date range selector object and its functions and properties via the data attribute bound to that element.
setStartDate(Date object, moment object or string type): Sets the currently selected start date in the date range selector to the provided date setEndDate(Date object, moment object or string type): Sets the date range selector The currently selected end date in is the provided date
Example usage:
1 2 3 4 5 |
|
Event
Date Picker Binding The elements can trigger the following events, and you can listen to these events.
show.daterangepicker: The event is triggered after the date picker is displayed hide.daterangepicker: The event is triggered after the date picker is hidden showCalendar.daterangepicker: The event is triggered after the calendar is displayed hideCalendar.daterangepicker: The event is triggered after the calendar is hidden apply.daterangepicker: The event cancel.daterangepicker is triggered when the apply button is clicked, or the predefined range label is clicked:
Triggers the event when the cancel button is clicked
Some applications require "clear" instead of "cancel" function , this can be achieved by changing the button label and listening for the cancel event:
1 2 3 4 5 6 |
|
Passing a callback function as a parameter to the constructor is the easiest way to listen for changes in the selected date range, even if the selection has not changed, each time the button is applied When clicked, you can also perform certain operations:
1 2 3 4 5 |
|
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
Operation Angularjs cross-domain setting whitelist
redux-thunk practical project case detailed explanation
The above is the detailed content of How to operate the calendar range selection plug-in. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to introduce bootstrap into Eclipse

How to read the bootstrap mediation effect test results in stata

750,000 rounds of one-on-one battle between large models, GPT-4 won the championship, and Llama 3 ranked fifth

How to read the results of bootstrap mediation test

How to use bootstrap to test mediation effects

What is the difference between bootstrap and springboot

How to export the results of bootstrap test mediation effect stata command
