Browse Source

Rimossi eventi ripetibili per implementarli in una pagina separata

gine 7 years ago
parent
commit
b2ccb4fcbf
1 changed files with 5 additions and 18 deletions
  1. 5 18
      www/js/crud.events.js

+ 5 - 18
www/js/crud.events.js

@@ -25,24 +25,14 @@ EVENTS.formatDate = function(date, format) {
     return mdate.isValid() ? mdate.format(format) : "";
 };
 
-EVENTS.eventsLoaded = 0;
-
 EVENTS.render = function() {
-    EVENTS.eventsLoaded = 0;
-    
-//    //Se si lancia il loader prima che sia cambiata pagina il loader scompare,
-//    // ritardando invece che appaia, quando appare è già sulla pagina in cambiata
-//    setTimeout(function () {
-//        $.mobile.loading('show');
-//    }, 300);
-    
     var ret = checkConnection('ERR_EVENT');
     if (ret) {
         EVENTS.getDataAndLoad(ai1ec.cats.single);
-        EVENTS.getDataAndLoad(ai1ec.cats.repeat);
+        //EVENTS.getDataAndLoad(ai1ec.cats.repeat);
     } else {
         EVENTS.loadFromDb('#mostralista-'+ ai1ec.cats.single, ai1ec.cats.single);
-        EVENTS.loadFromDb('#mostralista-'+ ai1ec.cats.repeat, ai1ec.cats.repeat);
+        //EVENTS.loadFromDb('#mostralista-'+ ai1ec.cats.repeat, ai1ec.cats.repeat);
     }
 };
 
@@ -103,13 +93,10 @@ EVENTS.getDataAndLoad = function (type) {
 };
 
 EVENTS.hideLoader = function(){
-    if(EVENTS.eventsLoaded >= Object.keys(EVENTS.table).length)
-        $.mobile.loading('hide');
+    $.mobile.loading('hide');
 };
 
 EVENTS.errorHandler = function(msg, type) {
-    EVENTS.eventsLoaded++;
-    
     if(type === 'info') {
         toastr.info(msg);
     } else {
@@ -147,13 +134,13 @@ EVENTS.loadFromDb = function (containerId, type) {
                     
             items.push(li);
         }
-        EVENTS.eventsLoaded++;
+        
         $(containerId).empty();
         $("<ul/>", {
             html: items.join("")
         }).prependTo(containerId);
 
-        EVENTS.hideLoader()
+        EVENTS.hideLoader();
     }, function (error) {
         EVENTS.errorHandler("Err: nel caricamento dei dati dal db");
     });