Rimossi eventi ripetibili per implementarli in una pagina separata

This commit is contained in:
gine 2017-04-08 16:27:02 +02:00
parent 34e9ee2fa5
commit b2ccb4fcbf

View file

@ -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");
});