I. Overview
1.1 Requirement
The Start Date widget and the End Date widget are used to query data collected within a week. When the Start Date is picked, the End Date is always 7 days greater than the Start Date by default. The actual effect is shown as below:
1.2 Solution
Add an Edit End event to the Start Date. Use JavaScript to set the End Date 7 days greater than the Start Date.
II. Sample
2.1 Add an event
In the Edit Parameter Interface, select the starttime widget and add an Edit End event. See the demonstration below:
Input the following JavaScript codes:
var date1=new Date(this.getValue());
var date2= new Date();date2.setTime(date1.getTime()+(7*24*60*60*1000));
this.options.form.getWidgetByName("endtime").setValue(date2);
2.2 Preview
Save the template and click [Pagination Preview]. The preview effect on a PC is shown as below: