Controls whether the parameter control is displayed (available) depending on the condition

Source: Internet
Author: User

1. Application Scenario

When you use the Report Tool Finereport to design a report, sometimes we want a partial parameter control to not display when the condition is met, and then display it when the condition is met, such as effect: only the previous drop-down box has the content selected, and the next-level drop-down box control is displayed:


2. Solutions

The control controls are initially initialized to be invisible or unavailable, and then the edit End event is added on the conditional control, and the control control is visible or available via the JS script, and the corresponding JS method is as follows:

Setenable (Boolean): Set is available, True is available, false is unavailable;

SetVisible (Boolean): setting is visible, true is visible, false is not visible;

3. Example

Open Template%fr_home%\webreport\web-inf\reportlets\doc\parameter\\multivalue\mutivalue.cpt

We use area in this template as the conditional control, province as the controlled control to illustrate the setup process.

3.1 Initializing the controlled control as invisible

Click the province control, select Property sheet > Basic properties will be visible tick off, such as:


3.2 Event settings for the control of a piece

To add an edit event to the area control, call the JS method to make the province control visible, with the following code:

Select the drop-down box control for the parameter area, select the event panel for the property sheet, and add an post-edit event such as:


Where the code is:


1.     var province=this.options.form.getwidgetbyname ("province");                                                                                                                                                               &nbsP; var area=this.options.form.getwidgetbyname ("area");    

2. var Thislen = this.getvalue (area). length;

3. if (Thislen) province.setvisible (true);

4. Else alert ("Please select Region");



Controls whether the parameter control is displayed (available) depending on the condition

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.