Browse Source

resolvendo erro de carregamento dos formularios (desabilitando ajax do jquerymobile)

diagnosticos
Felipe Vieira 13 years ago
parent
commit
3e94b2ca17
  1. 58
      media/js/diagnosticos/diagnosticos_categoria_form.js
  2. 6
      sigi/templates/base_mobile.html
  3. 2
      sigi/templates/diagnosticos/diagnosticos_categorias_form.html

58
media/js/diagnosticos/diagnosticos_categoria_form.js

@ -1,36 +1,36 @@
// cntabiliza a quantidade de requests $('#page').live('pageinit', function(event){
// ajax para nao desabilitar o loader // cntabiliza a quantidade de requests
// antes da hora // ajax para nao desabilitar o loader
var nun_ajax = 0; // antes da hora
var nun_ajax = 0;
// variaveis globais para as requisicoes // variaveis globais para as requisicoes
// ajax // ajax
$.ajaxSetup({ $.ajaxSetup({
url: $(location).attr('href'), url: $(location).attr('href'),
cache: false, cache: false,
type: 'POST', type: 'POST',
dataType: "text", dataType: "text",
beforeSend: function() { beforeSend: function() {
nun_ajax++ nun_ajax++
$.mobile.showPageLoadingMsg(); $.mobile.showPageLoadingMsg();
$.mobile.fixedToolbars.show()
},
success: function() {
nun_ajax--
if (nun_ajax == 0) {
$.mobile.hidePageLoadingMsg();
$.mobile.fixedToolbars.show() $.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 // remove a resposta vazia da interface
$("div.ui-radio span.ui-btn-text:contains('---------')").parentsUntil("ul").hide() $("div.ui-radio span.ui-btn-text:contains('---------')").parentsUntil("ul").hide()

6
sigi/templates/base_mobile.html

@ -9,6 +9,12 @@
{% block media %} {% block media %}
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script language=javascript>
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
$.mobile.loadingMessage = 'salvando';
});
</script>
<script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
{% endblock media %} {% endblock media %}
</head> </head>

2
sigi/templates/diagnosticos/diagnosticos_categorias_form.html

@ -42,3 +42,5 @@
</div> </div>
</div> <!-- footer --> </div> <!-- footer -->
{% endblock rodape %} {% endblock rodape %}

Loading…
Cancel
Save