A way to disable selection by a widget's script:
(() => {
widget.on("initialized", () => {
widget.metadata.$$widget.disableSelector = true;
})
})()
Another to disable for all dashboard's widgets, by a dashboard's script:
(() => {
// Simple version to disable selection for all widgets
const disableAllSelections = () => {
// Get all widgets from dashboard
const widgets = dashboard?.widgets || Object.values(prism?.widgets || {});
widgets.forEach((widget, index) => {
if (widget) {
const applyDisable = () => {
if (widget.metadata?.$$widget) {
widget.metadata.$$widget.disableSelector = true;
}
};
// Apply immediately if already initialized
if (widget.metadata?.$$widget) {
applyDisable();
} else {
// Wait for initialization
widget.on?.("initialized", applyDisable);
}
}
});
};
// Run immediately and on dashboard events
disableAllSelections();
// Listen for dashboard events
dashboard?.on?.('ready', disableAllSelections);
dashboard?.on?.('widgetsloaded', disableAllSelections);
})();