Get the Selected Rows in a Table
This applies to: Managed Dashboards, Managed Reports
Learn how to get the selected row ordinals and the selected row hierarchy members in a table using script.
Script Library sample: Get selected table data
Get the Selected Row Ordinals
Create a new dashboard and add a table visualization to it with data.
For this example, we will enable the Allow Multiple Row Selection property of the table. Also add a button component and a label component.
Add the following script on the Click event of the button.
var indexes = table1.control.getSelectedRowOrdinals();
label1.labelText = indexes.toString();
This script refers to the following API methods and properties:
Switch to View mode and select one or more rows in the table. Click the button to see the selected row indexes/ordinals appear in the label.
Get the Selected Hierarchy Members
To get the list of hierarchy members of the selected rows in a row header, change the button click script to use the getSelectedRowHierarchyMembersmethod:
Switch to View mode and select one or more rows in the table. Click the button to see the selected hierarchy members appear in the label.
For more information, see:
Comments
0 comments
Please sign in to leave a comment.