samedi 9 juillet 2016

jquery dialog for slow process

I have a blob of javascript code that takes a while to run when the user clicks it. It checks and unchecks a few hundred checkboxes on screen based on criteria. I want to give feedback that the process is running, so I figured a jquery dialog popping up would be good. The problem I'm having is that it seems the DOM isn't updated until after the long process is done. I have the code below and if I remove the dialog("close"), the dialog does eventually show, after the long process is complete. Without the close, it's just opening and immediately closing. How can I force it to open the dialog before it goes to my slowProcess()? I have tried using .delay() and setTimeout(). $( "#dialog-working" ).dialog({ modal: true, draggable: false, closeOnEscape: false, resizable: false, autoOpen: false }); $('.masscheck').on('click',function(){ $('#dialog-working').dialog( "open" ); slowProcess(); $('#dialog-working').dialog( "close" ); });

Aucun commentaire:

Enregistrer un commentaire