Switching Pages Through FVS Widgets and JS

  • Last update:  2023-04-11
  • Overview

    Application scenarios: If you have installed the FVS plugin, you can view this article to learn how to create FVS templates.

    Note: Mobile devices are not supported.

    Version

    Report Server Version

    Plugin Version

    Function Changes

    V11.0.5

    V1.5.0

    Six new types of Widget   Components and new events and interfaces that widgets support

    Expected Effect

    In the document, FVS Click to Switch Page, it is known that pages switching can be implemented by using JavaScript code. This article introduces switching pages through adding the JS event to the widget.

    Taking the drop-down box as an example, the expected effect is shown in the following figure:

    控件切换分页JS应用.gif

    Implementation Process

    Set the value of the widget data dictionary to the corresponding page name, and then add the Edit End event to the widget by using JavaScript code.

    The JavaScript code is as follows:

    var a = duchamp.getWidgetByName("fenye").getValue(); // Get the value of the fenye widget component

    duchamp.switchStory(a); // Jump to the corresponding page

    Example

    Preparing the Template

    Click File > New FVS Report in the top left corner of the FineReport Designer and customize the template name and size according to the situation.

    image 67.png

    Designing the Template

    1. Creating Multiple Pages

    Click New Page at the bottom of the template canvas to create multiple pages, and then add a chart to each page at will.

    Select the chart, click or drag it to the canvas.

    image 68.png

    2. Adding the Title Component

    For a clearer view of the demonstration, add a title component on each page with the current page name as the content.

    image 69.png

    3. Adding the Drop-Down Box Widget

    For convenience, you can add a drop-down box widget to a certain page, and after that, copy and paste the widget to other pages.

    a. Add the widget, adjust the position and size, and set the widget name to fenye, indicating that the parameter is fenye.

    image 70.png

    b. Set the data dictionary of the drop-down box widget to Custom, click the add button, and set the actual value and display value to the corresponding page name.

    image 71.png

    c. You can modify other settings according to the situation. In this example, set Default Value to Page 1 and untick Allow null.

    image 72.png

    Setting the Edit Finish Event for the Drop-Down Box

    Select the drop-down box widget, click Interaction > Add Event > Edit Finish in the configuration area on the right, and enter the event name and JavaScript execution script:

    var a = duchamp.getWidgetByName("fenye").getValue(); // Get the value of the fenye widget component

    duchamp.switchStory(a); // Jump to the corresponding page

    image 73.png

    After settings are complete, you can copy and paste the widget to other pages. Widgets with the same name on different pages represent the same parameter.

    Click Preview in the upper right corner and the effect is as shown in the section "Expected Effect".

    Template Download

    Click to download the template: Switching Pages Through FVS Widgets and JS.fvs

    Attachment List


    Theme: FineVis Data Visualization
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy