Facility Control

 View Only
  • 1.  Select Row in Table with a button

    Posted 01-20-2020 20:17

     

    Hi All,

     

        I have created a dashboard panel that has a table of data in rows and columns. I am trying to have a button to select a specific row in the table. The example would be if I have 50 rows and I no row 43 is always player #43, then I can have a button labeled #43, it will goto that row in the table and playout a graphic.

    currently, I can do this by selecting the row and having it fire that way, but I want to have it as simple as can be where you just click the button and it goes to the correct data.

    Thanks for your help

    Curtis



  • 2.  RE: Select Row in Table with a button

    Posted 01-20-2020 21:25


    Hi Curtis,

    Thanks for contacting DashBoard Support.
    Here is what I found for you!.

    Yes, you can add a button that can select the specific row of a table widget.

    You can add a button with ogScript task in it.
    params.setValue('params.table', 0, 2);

    Here the button will set the table parameter value as 2 to select 3rd row.

    Below is the example panel that I have created to select table rows from 1 to 6.


    <abs contexttype="opengear" keepalive="true">
    <meta>
    <params>
    <param access="1" constrainttype="STRING_CHOICE" name="table" oid="params.table" precision="0" type="INT16" value="0" widget="table">
    <constraint>col1</constraint>
    <constraint>col2</constraint>
    <constraint>col3</constraint>
    </param>
    <param access="1" maxlength="0" name="Column 1" oid="col1" precision="0" type="STRING_ARRAY" widget="default">
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>sadf</value>
    <value>sadf</value>
    </param>
    <param access="1" maxlength="0" name="Column 2" oid="col2" precision="0" type="STRING_ARRAY" widget="default">
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>sadf</value>
    <value>sadf</value>
    </param>
    <param access="1" maxlength="0" name="Column 3" oid="col3" precision="0" type="STRING_ARRAY" widget="default">
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>asdf</value>
    <value>sadf</value>
    <value>sadf</value>
    </param>
    </params>
    </meta>
    <param expand="true" height="446" left="137" oid="params.table" showlabel="false" top="109" width="369"/>
    <table height="461" left="612" top="111" width="157">
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="1" name="1" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 0);</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="2" name="2" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 1);</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="3" name="3" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 2);</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="4" name="4" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 3);</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="5" name="5" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 4);</task>
    </button>
    </tr>
    <tr>
    <button buttontype="push" colspan="1" fill="both" id="6" name="6" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">params.setValue('params.table', 0, 5);</task>
    </button>
    </tr>
    </table>
    </abs>

     


    Let me know if you need any further information on this.


    Regards
    Anand

     


    #DashBoard


  • 3.  RE: Select Row in Table with a button

    Posted 01-21-2020 04:27

    thanks, for some reason I never tried it on the table itself. I was trying the table columns. It works exactly how I wanted.


    #DashBoard


  • 4.  RE: Select Row in Table with a button

    Posted 01-22-2020 11:58

    Just want to point out that this works for this type of table.
    If you move to structs and use those for creating tables instead, and you enable the "sort" attribute, this will jumble your selections. If you use the parameter version of a table (that is used by Anand in the example above) this will still work though.

    Just a little heads up that the two options might work differently then you expect.


    #DashBoard