Closed Yusufzai closed 2 years ago
I understand that you are clearing the data with the function "clearModuleSelected".
What you can do is loop through the "editor.export" and remove only your node with the "removeNodeId" function.
Thanks it worked :)
Below is my code in case if anybody need it.
// On click of the clear Button
document.querySelector('.clear-data-button').addEventListener('click', function() {
exportList = editor.export().drawflow.Home.data;
Object.keys(exportList).map((k) => {
getInfo = editor.getNodeFromId(k);
getName = getInfo.name;
// Condition to check for the widget that should not be deleted
// In this case it is global-widget
if (getName === 'global-widget') {
return;
} else {
editor.removeNodeId(`node-${k}`);
}
})
})
Let suppose I have total 6 widgets from which 5 of them are comman and 1 is global widget (like mentioned below)
global widget widget - 1 widget - 2 widget - 3 widget - 4 widget - 5
So what I want?
When I press on clear button I don't want to delete global widget (I only want to remove widget 1 - 6).
https://prnt.sc/23ptard