Direct Auto Query by JS

  • Last update:April 29, 2025
  • Overview

    Version

    Report Server VersionFunctional Change
    11.0 -

    Expected Effect

    On the built-in query page, you can view the data by clicking the query button. How can you view the result automatically after entering the parameter without clicking the query button or re-triggering the query after filling, as shown in the following figure? The following figure shows the effect.

    1.gif 

    Implementation Method

    You can achieve this effect by unchecking the Display Nothing Before Query button, or adding the JS event.

    You can uncheck the Display Nothing Before Query to view the data without clicking the button at the first query. For details about unchecking the button, see the corresponding section of Parameter Panel Overview.

    You can add the JS script _g().parameterCommit() to the template to trigger the query event, after which you can query the data automatically by modifying the parameter, as shown in this document.

    iconNote: 

    1. The implementation method is also applicable to dashboards.

    2. The solution introduced in this document is a global refresh. For details about refreshing the specified objects, see Linkage Between a Drop-down Box and a Chart.

    Example

    Template Preparation

    Prepare a template that requires a parameter query, without a query button on the parameter panel.

    Open the template GettingStartedEN.cpt in %FR_HOME%\webapps\webroot\WEB-INF\reportlets, and delete the Query button on the parameter panel, as shown in the following figure.

     2.png

    Click to download the template: GettingStartedEN.cpt

    Event Adding

    Click the drop-down box widget on the parameter panel, and add an After Editing event to the widget, after which you can query the report after selecting a value from the drop-down box, as shown in the following figure.

     3.png

    The JavaScript code is as follows:

    iconNote:

    If an error occurs due to the inability to read undefined properties, you can add a delay function to postpone the execution. 

    _g().parameterCommit(); 

    Effect Display

    Save the report, and click Pagination Preview, after which you can query the data automatically by selecting a value from the drop-down box widget. The effect on PC is the same as that shown in section "Expected Effect."

    The following figure shows the preview effect on the DataAnalyst app and the HTML5 terminal.

     4.gif

    Template Download

     For details, you can download the template Direct Auto Query by JS.cpt

    Attachment List


    Theme: Parameter
    Already the First
    Already the Last
    • 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