Successfully!

Error!

[General] JS Through the Button Widget Switch Dialog Box

  • Last update:  2021-12-27
  • I. Overview

    1. Version

    Report server versionJAR package versionAPP versionHTML5 mobile display plug-in
    10.02020-06-0810.4.6V10.4.6


    2. Expected effect

    When the user data entry in the report on the mobile terminal, he hopes to open a dialog box on the current page byclicking the button to data entry. After data entry, user can directly close the dialog box through the Submit ButtonAs shown below:

    7.gif


    3. Implementation method

    The user can switch the dialog box through the button widget through JavaScript, and the specific settings are as follows:

    Note 1: Only the button widget under the decision report are supported, and ordinary reports are not supported.

    Note 2: The content of the pop-up window only supports templates, not plain text.

    1) Close the dialog box pop-up window

    FR.closeMobilePopup();

    2) Open the dialog box pop-up window

    FR.mobilePopup{
        target: 'template',
        parameters: {},
        setting: {
            templatePath: '/xxx.cpt',
            xxx:xxx
            xxx:xxx
        }
    }

    II. Example

    1. Sub-template

    1) Set template

    Open the template:FR_HOME%\webapps\webroot\WEB-INF\reportlets\demo\Mobile\MobileData Entry\Leave Request_mobile.frm

    Save as:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc\phone\JS\JS_through_the_button_widget_switch_dialog_box_sub-template.frm

    2) Add a click event to close the dialog box

    Select button widgetbutton0, ClickComponent Settings>Event,Add toClick event, Add JavaScript code, as shown in the following figure:

    1.png


    The JavaScript code is as follows:

    FR.closeMobilePopup(); 


    2. Main template

    1) New template

    Create a new dashboard and save it as:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\JS_through_the_button_widget_switch_dialog_box_main-template_mobile.frm

    Set mobile terminal attributes

    Click onTemplates>Mobile Attribute, CheckSet as mobile template,As shown below:

    2.png

    Set the layout

    SelectedComponent settings>body>Attributes,set upLayoutforAbsolute layout,As shown below:

    3.png

    2) Set button widiget

    Add button widget

    SelectedButton widget, Drag tobody interface, as shown in the figure below:

    4.png

    Set the widget name

    Select button widgetbutton0, ClickComponent Settings>Attributes,set upButton NameforClick to open the sub-template,As shown below: 

    5.png

    3) Add a click event to open the dialog box

    Select button widgetbutton0, ClickComponent Settings>Event,Add toClick event, Add JavaScript code, as shown in the following figure:

    6.png

    The JavaScript code is as follows:

    FR.mobilePopup({
    target: "template",
    parameters: {},
    setting: {
    templatePath: "/JS_through_the_button_widget_switch_dialog_box_sub-template.frm",     
    border: {
    type: 0,
    color: "rgb(0,0,0)",
    borderRadius: 4.0
    },
    background: {
    color: "rgb(255,255,255)"
    },
    mobileRegular: {
    type: "custom" || "auto_height",
    heightPercent: 95.0,
    widthPercent: 95.0
    },
    padRegular: {
    type: "custom" || "auto_height",
    heightPercent: 95.0,
    widthPercent: 95.0
    }
    }
    });


    3. Effect preview

    Open the main template and clickMobile previewClick the button to open on the current pageSub-template dialogAfter completing the report, clickSubmitButton, the sub-template is automatically closed.

    The preview effect of App and HTML5 terminal is as shown in the figure below:

    7.gif

    III. Completed template

    1) Main template

    Please refer to the completed template:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\JS_through_the_button_widget_switch_dialog_box_main-template_mobile.frm

    Click to download the template:

    JS_through_the_button_widget_switch_dialog_box_main-template_mobile.frm

    2) Sub-template

    Please refer to the completed template:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\JS\JS_through_the_button_widget_switch_dialog_box_sub-template.frm

    Click to download the template:

    JS_through_the_button_widget_switch_dialog_box_sub-template.frm

    Attachment List


    Theme: Fine Mobile
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback