Browse Source

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

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

60
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()

6
sigi/templates/base_mobile.html

@ -9,6 +9,12 @@
{% block media %}
<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 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>
{% endblock media %}
</head>

2
sigi/templates/diagnosticos/diagnosticos_categorias_form.html

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

Loading…
Cancel
Save