Zombie tabs
- 9 months ago
It makes sense that the behavior appears in the context of a dialog. This is very similar to the post I mentioned before.
In the shown use case dirty items aren´t a big problem as the dialog is mainly executed from released items. In my case I reset the "isDirty" attribute to 0 inside the dialog callback function. This is important when user close the dialog without doing anything. Things get more complicated for item that can still be edited.
Quote: "checks if the item is dirty and saves it if it is"
That´s one approach that I also use sometimes! You can even execute the save action automatically in silent mode to avoid to distract the user. As alternative, you can of course just tell the user to save first by themselves. This is an actual code sample that I use when I don´t want use the silent mode. Use case is an automatically sort_order renumbering function that user can use while working with the relationships:
// Don´t renumber if item is dirty (=unsaved changes)
const isDirty = window.aras.isDirtyEx(contextItem.node);
if (isDirty)
{
return aras.AlertError("Blablabla please save first....");
}I am not sure if this is the official recommended way to deal with dirty items. But I have seen similar solutions in the OOTB Innovator code.