new-grid: fixed destory issues

This commit is contained in:
Torkel Ödegaard 2017-08-10 15:08:53 +02:00
parent 23666c0f78
commit 7cb6093dba
2 changed files with 15 additions and 3 deletions

View File

@ -58,11 +58,20 @@ export class GridCtrl {
}
bindItem(element) {
this.gridstack.makeWidget(element);
if (this.gridstack) {
this.gridstack.makeWidget(element);
}
}
removeItem(element) {
this.gridstack.removeWidget(element, false);
if (this.gridstack) {
this.gridstack.removeWidget(element, false);
}
}
destroy() {
this.gridstack.destroy();
this.gridstack = null;
}
}
@ -81,6 +90,10 @@ export function dashGrid($timeout) {
$timeout(function() {
ctrl.init();
});
scope.$on('$destroy', () => {
ctrl.destroy();
});
}
};
}

View File

@ -653,7 +653,6 @@ export class DashboardModel {
if (oldVersion < 15) {
this.upgradeToGridLayout();
console.log(this.panels);
}
if (panelUpgrades.length === 0) {