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

First, the controlled control is initialized to be invisible or unavailable, and then added on the conditional control Edit End Event , through the JS script settings are visible or available control control, the corresponding JS method is as follows:

setenable (Boolean) : setting is available, True is available, false is not available;

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

3. Example

Open a 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");                                                                                                                                                                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 ");


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.