Transform webix confirm in "synchronous mode"

webix.confirm use callback function (asynchronous mode) and I wan’t that my popup become synchronous like basic ‘confirm’ of javascript. Is it possible ?

I have a function that check something , and I must leave the function just after callback result.

if you use a function, what is wrong with calling it from confirm’s callback?

I give you an example :

https://snippet.webix.com/yf32576u

My problem is that I leave the function before the choice when I call the function and I have not this problem with basic ‘confirm’ of javascript

https://snippet.webix.com/1z0w88zi

Thanks for response , your solution looks good for my fuction , but I have the same problem later :frowning:

I give you the problem :

https://snippet.webix.com/xm42qyhs

https://snippet.webix.com/dwl876cf

Thanks for reactivity.

I can explain the general problem.
I have a complex application that use the function (checkIfFormSaved) in all views.
For one view for exemple , when I have a form filled, I tested all interaction (click) in other objects (datatables , buttons , treetables, tabs etc…) and I give the user the possibility to stay in form or to continue.
That’s why when I used a basic ‘confirm’ , that stop the execution and I can intercept the execution with all objects.
But I wan’t to use the webix.confirm , that’s why I need to change the code of my application.

With your solution for a datatable (for example), I have a problem : I lost the event ‘onAfterSelect’. I use ‘onBeforeSelect’ for the test of form and ‘onAfterSelect’, ‘onItemClick’ etc for all interactions (show or hide view …) .

Any Ideas ?

Thanks

you can call onAfterSelect manually just after datatable.unblockEvent
https://snippet.webix.com/aywmcadz
it is a hack, but should work.

if you must have sync flow, then use native confirm.
but it is not too hard to use async mode

Thanks :wink:

The callEvent works but I lost the ‘bind’ between datatable and form :frowning:

I tried :

$$(“xslinksDatatable”).callEvent(“onAfterSelect”, [$$(“xslinksDatatable”).getItem(data.id)]);

and

$$(“xslinksDatatable”).callEvent(“onAfterSelect”, [data]);

with no success

https://snippet.webix.com/kan9a2bt
a bit more advanced hack :wink:

Perfect :wink: thanks