From 3e94b2ca1775ce1390af7f139bbb35c38023b8af Mon Sep 17 00:00:00 2001 From: Felipe Vieira Date: Tue, 29 Nov 2011 17:37:41 +0000 Subject: [PATCH] resolvendo erro de carregamento dos formularios (desabilitando ajax do jquerymobile) --- .../diagnosticos_categoria_form.js | 60 +++++++++---------- sigi/templates/base_mobile.html | 6 ++ .../diagnosticos_categorias_form.html | 2 + 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/media/js/diagnosticos/diagnosticos_categoria_form.js b/media/js/diagnosticos/diagnosticos_categoria_form.js index 002b0f5..e20b9e2 100644 --- a/media/js/diagnosticos/diagnosticos_categoria_form.js +++ b/media/js/diagnosticos/diagnosticos_categoria_form.js @@ -1,36 +1,36 @@ -// cntabiliza a quantidade de requests -// ajax para nao desabilitar o loader -// antes da hora -var nun_ajax = 0; - -// variaveis globais para as requisicoes -// ajax -$.ajaxSetup({ - url: $(location).attr('href'), - cache: false, - type: 'POST', - dataType: "text", - beforeSend: function() { - nun_ajax++ - $.mobile.showPageLoadingMsg(); - $.mobile.fixedToolbars.show() - }, - success: function() { - nun_ajax-- - if (nun_ajax == 0) { - $.mobile.hidePageLoadingMsg(); +$('#page').live('pageinit', function(event){ + // cntabiliza a quantidade de requests + // ajax para nao desabilitar o loader + // antes da hora + var nun_ajax = 0; + + // variaveis globais para as requisicoes + // ajax + $.ajaxSetup({ + url: $(location).attr('href'), + cache: false, + type: 'POST', + dataType: "text", + beforeSend: function() { + nun_ajax++ + $.mobile.showPageLoadingMsg(); $.mobile.fixedToolbars.show() + }, + success: function() { + nun_ajax-- + if (nun_ajax == 0) { + $.mobile.hidePageLoadingMsg(); + $.mobile.fixedToolbars.show() + } + }, + error: function(msg) { + nun_ajax-- + $.mobile.hidePageLoadingMsg(); + $.mobile.fixedToolbars.show(); + $("#open-dialog").click() } - }, - error: function(msg) { - nun_ajax-- - $.mobile.hidePageLoadingMsg(); - $.mobile.fixedToolbars.show(); - $("#open-dialog").click() - } -}); + }); -$( '#page').live('pageinit', function(event){ // remove a resposta vazia da interface $("div.ui-radio span.ui-btn-text:contains('---------')").parentsUntil("ul").hide() diff --git a/sigi/templates/base_mobile.html b/sigi/templates/base_mobile.html index 236fb16..10b6419 100644 --- a/sigi/templates/base_mobile.html +++ b/sigi/templates/base_mobile.html @@ -9,6 +9,12 @@ {% block media %} + {% endblock media %} diff --git a/sigi/templates/diagnosticos/diagnosticos_categorias_form.html b/sigi/templates/diagnosticos/diagnosticos_categorias_form.html index 67ea131..a80a8b3 100644 --- a/sigi/templates/diagnosticos/diagnosticos_categorias_form.html +++ b/sigi/templates/diagnosticos/diagnosticos_categorias_form.html @@ -42,3 +42,5 @@ {% endblock rodape %} + +