Improved the stability

This commit is contained in:
Alejandro Gallardo Escobar 2014-12-18 14:41:21 +01:00
parent 93b248bf14
commit b568156211

View File

@ -298,11 +298,15 @@ TreeNodeDetailController = {
} }
}, },
removeControllers: function () { removeControllers: function () {
TreeNodeDetailController.controllers.forEach(function(elements, type) { if (TreeNodeDetailController.controllers.length > 0) {
elements.forEach(function(element, id) { TreeNodeDetailController.controllers.forEach(function(elements, type) {
element.remove(); if (elements.length > 0) {
elements.forEach(function(element, id) {
element.remove();
});
}
}); });
}); }
}, },
getController: function () { getController: function () {
var controller = { var controller = {
@ -457,24 +461,37 @@ TreeNodeDetailController = {
this.recipient.empty(); this.recipient.empty();
} }
if (this.type != 'none' && this.id > -1) { if (this.type != 'none' && this.id > -1) {
delete TreeNodeDetailController.controllers[this.type][this.id]; try {
delete TreeNodeDetailController.controllers[this.type][this.id];
}
catch (error) {
// console.log('Item not deleted');
}
} }
}, },
closeOther: function () { closeOther: function () {
TreeNodeDetailController.controllers.forEach(function(elements, type) { if (TreeNodeDetailController.controllers.length > 0) {
elements.forEach(function(element, id) { TreeNodeDetailController.controllers.forEach(function(elements, type) {
if (this.type != type && this.id != id) if (elements.length > 0) {
element.close(); elements.forEach(function(element, id) {
if (this.type != type && this.id != id)
element.close();
}, this);
}
}, this); }, this);
}, this); }
}, },
removeOther: function () { removeOther: function () {
TreeNodeDetailController.controllers.forEach(function(elements, type) { if (TreeNodeDetailController.controllers.length > 0) {
elements.forEach(function(element, id) { TreeNodeDetailController.controllers.forEach(function(elements, type) {
if (this.type != type && this.id != id) if (elements.length > 0) {
element.remove(); elements.forEach(function(element, id) {
if (this.type != type && this.id != id)
element.remove();
}, this);
}
}, this); }, this);
}, this); }
} }
} }
return controller; return controller;