Closed daemons2000 closed 2 years ago
@daemons2000 you can achieve this by enabling the confirmation option in the settings of the delete action. Modals alerts are not synchronous in JS so I think an async / callback approach makes sense as a new function
Modals alerts are not synchronous in JS
Sorry for the confusion. Here I'm not talking how it's done in JS. I am talking about the fact that you own developer's experience and you might choose to make this experience convenient and let the developer feel as if the call is sync. Behind the scenes it still may use a promise but syntactically and logically the developer would use it as a sync call -- which is more practical in case of confirmation modals.
Anyway, simple callbacks would certainly work here.
I did not notice the confirmation flag you mentioned but I tried it now and I can say that the use cases I am referring to require much more flexible functionality: I need inputs, texts, sometimes tables. By reviewing the contents of these controls, the user would be able to decide if he's going to proceed with the action or cancel.
@daemons2000 if underneath the hood it is asynchronous, there is no way for us to make it synchronous that I know of. Would be happy to hear your ideas if you have any. We use javascript everywhere in appsmith so we follow its paradigms, reap its benefits, and are restricted by its limitations.
Closing this since it doesn't align with the product
Please implement modal dialog functionality to return a modal result from the dialog to the caller.
Motivation/Use case: For a delete action, we need to display a confirmation popup with extended information (so that e.g. an ordinary JS alert() would not suffice). Once the user confirms his choice, the deletion carries on. Currently, we need to put the action handler into modal's OK button. Not only does this complicate code maintenance, also this makes impossible using the same modal for many other similar actions.
Possible implementations: