Best way to prevent widgets from being deleted?

Good Morning Community,

We have started to work on a project with the dashboard component in perspective, and we are trying to figure out if there is an efficient way to make widgets non deletables on a dashboard after adding them.

All suggestions are welcome,

Thanks in advance.

Is this a problem of accidental deletion in Designer or for a client user-configurable dashboard?

1 Like

client-user configurable solution. Trying to find out if there is a way for us to prevent them from removing some widgets on the dashboard as they need to be "essential widgets"

You can turn off editing of the dashboard all together, but you can't have an editable dashboard but prevent the user from being able to edit it.

1 Like

You could have multiple dashboards on one view, configure the essential widgets on one of the dashboards in designer then set editingToggle to false.

5 Likes

There's an idea.

This could be done pretty easily with css, just add the following to either your theme.css or 'Advanced Stylesheet'.

.ia_dashboardComponent__widget__controlBar__control.widget-control.widget-control-delete {
	display: none;
}

This will still allow any editing/configuring whilst removing the delete button.

If you need it to be only certain widgets, then I would add a class to the widget in the availableWidgets, then add that class to the css selector too.

Note: you will need to prepend '.psc-' so if the class in designer was 'widget-essential'

Then the selector in your stylesheet would be

.psc-widget-essential .ia_dashboardComponent__widget__controlBar__control.widget-control.widget-control-delete
2 Likes

This is an elegant solution to my problem and i plan to implement it, im not the OP i just want to thank you for this lol

1 Like