Set expanders to closed by default?

I’ve had several dashboards where it would be handy to have the dimensions’ expanders set to “closed” by default.

For instance, I have a list of employees whose names are colored using states and who have expanders. There are several rows of data for each employee, but what the user is most interested in is which state the employees are in. The user would only want to see the details on employees that they select, rather than be presented with all available data for all employees as the default.

Is there an “expanders closed by default” option?

I can see that it would be possible to close each expander manually and save the project, but I suspect that as new employees join the company that their expanders would be open. Maybe it’s possible to create a “close all expanders” button?

Hi,

You can probably keep the employee_info field collapsed by checking ‘Collapse All’ from the Data analysis Panel so that employee field turns up collapsed by default:
image

Or you can use the following script to collapse all:
// get table data
var cellset = table1.metricSetBindings[0].dataResult.cellset;

for (let i = 0; i < cellset.rows.length; i++) {
for (let j = 0; j < cellset.rows[i].members.length; j++){
var members = cellset.rows[i].members[0];
var drillDownSet = new dundas.data.DrillDownSet();
drillDownSet.placement=“Rows”;
drillDownSet.members.push(members.loadMemberValue());
// // Add drillDownSet to the tables expandedSets list
table1.metricSetBindings[0].dataResult.cellset.collapsedSets.push(drillDownSet);
}
}
table1.loadData({ saveScrollPosition: true });

To expand all, table1.metricSetBindings[0].dataResult.cellset.expandedSets.push(drillDownSet) can be used.

References:

1 Like

Thanks, Upasana!

I found that using “collapse all” like you suggested on the columns to the right of the employee name worked like I wanted. I’d been using “collapse all” on the employee name, which was the left-most column and had the result of turning the list of names into a single “All” label.

Thanks for the scripts, I’m sure I’ll get to use them too. :slight_smile:

1 Like