JS Report Button Control Gets Other Control Values

  • Last update:December 16, 2020
  • I. Overview

    1.1 Requirement

    In designing a dashboard, how to add a Button widget to get the values of other widgets?

    1.gif

      

    1.2 Solution

    Get widget names using jQuery:

    var a=$('div[widgetname=TEXTEDITOR0]').find('.fr-texteditor').val(); // Get the value of the Text widget textEditor0
    var b=$('div[widgetname=COMBOBOX0]').find('.fr-trigger-texteditor').val(); // Get the value of the Drop-down Box widget comboBox0
    var c=$('div[widgetname=LABEL0]').find('.fr-label').html(); // Get the value of the Label widget label0
     
    You will learn
    • Sample

      • Design of a dashboard

      • Add a Click event

      • Preview

    • Download the template

    II. Sample

    2.1 Design of a dashboard

    1) Drag a Button widget into a dashboard and name it Get Widget Value, as shown below:

    2) Drag a Text widget into a dashboard and assign the value I am a  textEditor to it.

     

    3) Drag a Drop-down Box widget into a dashboard and assign the value I am a comboBox to it.

     

    4) Drag a Label widget into a dashboard and assign the value I am a label to it.

     


    2.2 Add a Click event

    Click the Button widget and add a Click event, as shown below:

     

    Input the following JavaScript codes:

    var a = $('div[widgetname=TEXTEDITOR0]').find('.fr-texteditor').val(); // Get the value of the Text widget textEditor0
    var b = $('div[widgetname=COMBOBOX0]').find('.fr-trigger-texteditor').val(); // Get the value of the Drop-down Box widget comboBox0
    var c = $('div[widgetname=LABEL0]').find('.fr-label').html(); // Get the value of the Label widget label0
    alert(a);
    alert(b);
    alert(c);

    Note: widgetname in JavaScript codes represents the widget name, which should be capitalized. 

     

    2.3 Preview

    7.gif 

    III. Download the template

    1.frm

     

    Refer to the original link: https://help.finereport.com/doc-view-1884.html

     


    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