jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Problem with showloadelement
Tagged: showloadelement
This topic contains 2 replies, has 2 voices, and was last updated by loka 9 years, 1 month ago.
-
Author
-
Hello,
I’m having some issue with the showloadelement.
The autoshowloadelement is set at true and the showdefaultloadelement is set at true too.
I have a function with 2 ajax call, the first one show the Load image with no problem but it doesn’t show for the second call.
I try to add showloadelement with no effect.But if i comment the first ajax call, the load image show for the second ajax call (which become first…)
Here is my code :
var verificationStatut = function (urlCalculStatut, urlAnalyse, urlNumParution) { $("#confirmer").on('click', function (event) { $("#id_window_confirm").jqxWindow('close'); //enregistrerLignesModifiees('id_gridPeriodes', urlNumParution); // <= function with the first ajax call $("#id_gridPeriodes").jqxGrid('showloadelement'); $.ajax({ url: urlCalculStatut, data: '', type: 'POST', dataType: 'json', success: function (data) { $("#id_gridPeriodes").jqxGrid('hideloadelement'); afficherFlashBag('Analyse terminée', 'success', 'Le calcul des statuts est terminé.'); document.location.href(urlAnalyse); }, beforeSend: function (xhr) { $("#id_gridPeriodes").jqxGrid('showloadelement'); }, error: function (xhr) { $("#id_gridPeriodes").jqxGrid('hideloadelement'); afficherFlashBag('Erreur Premier calcul des statuts', 'error', 'Une erreur est survenue lors du premier calcul des statuts pour l\'analyse.'); } }); }); };
Is there something i’m missing ?
Hi loka,
I guess that the commented code creates a Grid. So while the Grid loads data, you call a Grid method. However, the Grid is not ready/initialized yet so nothing will and nothing should happen. The AJAX calls are asynchonous so you can’t also guarantee which one will finish first.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
No the grid is created before, the commented code only do an ajax call to save the modified lines (enregistrerLignesModifiees is french for saveModifiedLines).
The first ajax call to save the modified lines is quick (take only 1 to 3 seconds) and the second ajax call take a long time (more than 100 seconds) and the load image doesn’t show for this one (it show only if i comment “enregistrerLignesModifiees” like the code i posted).
I forgot to mention that in the commented function, i do this when the ajax call succeed :
$("#id_gridPeriodes").jqxGrid('updatebounddata', 'data'); $("#id_gridPeriodes").jqxGrid('refreshdata');
Maybe the problem is here ?
Regards,
Edit :
This was the problem, if i comment the 2 lines code it seems to work. I think i know how to fix this now.
Asking the question and your answer made me realize the problem… thanks -
AuthorPosts
You must be logged in to reply to this topic.