# Best way to prevent widgets from being deleted?

**URL:** <https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [August 21, 2024, 5:05pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961 "2024-08-21T17:05:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Pineda-Lugo](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@Jose\_Pineda-Lugo](https://forum.inductiveautomation.com/u/Jose_Pineda-Lugo)\
**Post date:** [August 21, 2024, 5:05pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/1 "2024-08-21T17:05:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 21, 2024, 5:20pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/2 "2024-08-21T17:20:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jose\_Pineda-Lugo](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@Jose\_Pineda-Lugo](https://forum.inductiveautomation.com/u/Jose_Pineda-Lugo)\
**Post date:** [August 21, 2024, 5:23pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/3 "2024-08-21T17:23:03Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 21, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/4 "2024-08-21T17:25:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [August 21, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/5 "2024-08-21T17:25:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 21, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/6 "2024-08-21T17:25:55Z")

</div>

There's an idea.

---

<div class="post-metadata">

**Author:** ![Nathan\_Moore](https://avatars.discourse-cdn.com/v4/letter/n/d78d45/32.png) [@Nathan\_Moore](https://forum.inductiveautomation.com/u/Nathan_Moore)\
**Post date:** [September 5, 2024, 8:59am UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/7 "2024-09-05T08:59:27Z")

</div>

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

```python
.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

```python
.psc-widget-essential .ia_dashboardComponent __widget__ controlBar__control.widget-control.widget-control-delete

```

---

<div class="post-metadata">

**Author:** ![Matthew\_Breeding](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@Matthew\_Breeding](https://forum.inductiveautomation.com/u/Matthew_Breeding)\
**Post date:** [November 8, 2024, 7:38pm UTC](https://forum.inductiveautomation.com/t/best-way-to-prevent-widgets-from-being-deleted/94961/8 "2024-11-08T19:38:54Z")

</div>

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
