EasyUI Forum
May 21, 2024, 12:43:05 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: window('open'); something.each(); then window('close') doesn't work in chrome  (Read 6545 times)
Juan Antonio Martínez
Jr. Member
**
Posts: 68



View Profile
« on: August 22, 2015, 04:30:01 PM »

Hi all.
I want a progress dialog window to be shown while several ajax call are being processed. So I have following code:
Code:
<!-- progress window to show inscription progress -->
<div id="new_inscripcion-progresswindow" class="easyui-window"
data-options="title:'Processing...',width:450,modal:true,collapsable:false,minimizable:false,maximizable:false,closable:false,closed:true">
<p id="new_inscripcion-progresslabel" style="text-align:center">Inscribiendo a:</p>
<div id="new_inscripcion-progressbar" class="easyui-progressbar" style="width:300px;text-align:center;" data-options="value:0"></div>
</div>
....
function insertInscriptions(dg) {
....
        var pwindow=$('#new_inscripcion-progresswindow');
var selectedRows= dg.datagrid('getSelections'); // take selected rows from provided datagrid
var count=1;
var size=selectedRows.length;

pwindow.window('open');
$.each(selectedRows, function(index,row) {
$('#new_inscripcion-progresslabel').text("Inscribiendo a: "+row.Nombre);
$('#new_inscripcion-progressbar').progressbar('setValue',(count*(100/size)).toFixed(2));
$.ajax({
           async: false, // NOTICE async set to false to ensure each() returns after last ajax call completed
           cache: false,
           timeout: 10000, // 10 seconds
   type:'GET',
   url:"/agility/server/database/inscripcionFunctions.php",
   dataType:'json',
   data: {
                               .....
   }
});
count++;
});
pwindow.window('close');
....
}

This code works fine in firefox: window is displayed, and progressbar shows progress on each ajax sync call; and when last ajax call is performed, window is closed
But when running in Google Chrome, window does not appear, ajax calls are performed but no window nor progress shown

What am I doing wrong?
Thanks in advance
« Last Edit: August 22, 2015, 05:12:18 PM by Juan Antonio Martínez » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: August 22, 2015, 06:38:19 PM »

Due to the detrimental effects to the end user's experience, the chrome does not allow synchronous request on the main thread. Please prevent from setting async to false when calling $.ajax.
Logged
Juan Antonio Martínez
Jr. Member
**
Posts: 68



View Profile
« Reply #2 on: August 23, 2015, 01:27:17 AM »

OK. I've seen deprecation notice in chrome dev console, but didn't know that modern chrome just ignores 'async:false' directive

I'll rewrite my code.
Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!