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