Thank you @Shawn_Optipath to optimize my code. I use javascript since a couple of weeks. I am very glad about your optimizations!
To the pcbPage_sqlQuery_setComponentsByTableFilter: I changed it like the following code:
// Get current filter stack
const stack = pcbPage_table_pcb.filterStack || { filters: [] };
// Determine applied filters
const productionOnlyFound = stack.filters.some(f => f.id === "pcbPage_checkbox_productionOnly");
const showDeletedFound = stack.filters.some(f => f.id === "pcbPage_checkbox_showDeleted");
// Update checkbox 'in production only'
pcbPage_checkbox_productionOnly.setValue(productionOnlyFound);
// Handle Viewer Mode Restriction
if (!showDeletedFound && var_appMode.value === 'viewer') {
utils.showNotification({
title: "Filter Change Error",
description: "In viewer mode, you can't display deleted items!",
notificationType: "error",
duration: 4.5,
});
// Update checkbox 'show deleted' set to false
pcbPage_checkbox_showDeleted.setValue(false);
// Reapply correct filters
pcbPage_sqlQuery_setTableFilterByComponents.trigger();
}
else {
// Update checkbox 'show deleted'
pcbPage_checkbox_showDeleted.setValue(!showDeletedFound);
}
Your code stucks in a endless loop. when deleting the filter for deleted rows of the table. Thank you very much. Could Retool optimize the description of the function table.updateLinkedFilter()? My code runs wonderful without this function... I am very confused...