Successfully!

Error!

JS Report Button Control Gets Other Control Values

  • Last update:  2020-12-16
  • 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: Dashboard
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback