commit
e6787c0b4d
@ -234,14 +234,16 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
|
|||||||
removeResizeListener(gridsterParent[0], onGirdsterParentResize); // eslint-disable-line no-undef
|
removeResizeListener(gridsterParent[0], onGirdsterParentResize); // eslint-disable-line no-undef
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watchWidgets();
|
||||||
|
|
||||||
function onGirdsterParentResize() {
|
function onGirdsterParentResize() {
|
||||||
if (gridsterParent.height() && autofillHeight()) {
|
if (gridsterParent.height() && autofillHeight()) {
|
||||||
updateMobileOpts();
|
updateMobileOpts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watchCollection('vm.widgets', function () {
|
function watchWidgets() {
|
||||||
sortWidgets();
|
$scope.widgetsCollectionWatch = $scope.$watchCollection('vm.widgets', function () {
|
||||||
var ids = [];
|
var ids = [];
|
||||||
for (var i=0;i<vm.widgets.length;i++) {
|
for (var i=0;i<vm.widgets.length;i++) {
|
||||||
var widget = vm.widgets[i];
|
var widget = vm.widgets[i];
|
||||||
@ -278,10 +280,22 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
|
|||||||
delete vm.widgetLayoutInfo[widgetId];
|
delete vm.widgetLayoutInfo[widgetId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$mdUtil.nextTick(function () {
|
||||||
|
sortWidgets();
|
||||||
if (autofillHeight()) {
|
if (autofillHeight()) {
|
||||||
updateMobileOpts();
|
updateMobileOpts();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopWatchWidgets() {
|
||||||
|
if ($scope.widgetsCollectionWatch) {
|
||||||
|
$scope.widgetsCollectionWatch();
|
||||||
|
$scope.widgetsCollectionWatch = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO: widgets visibility
|
//TODO: widgets visibility
|
||||||
/*gridsterParent.scroll(function () {
|
/*gridsterParent.scroll(function () {
|
||||||
@ -500,6 +514,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
|
|||||||
loadDashboard();
|
loadDashboard();
|
||||||
|
|
||||||
function sortWidgets() {
|
function sortWidgets() {
|
||||||
|
stopWatchWidgets();
|
||||||
vm.widgets.sort(function (widget1, widget2) {
|
vm.widgets.sort(function (widget1, widget2) {
|
||||||
var row1 = widgetOrder(widget1);
|
var row1 = widgetOrder(widget1);
|
||||||
var row2 = widgetOrder(widget2);
|
var row2 = widgetOrder(widget2);
|
||||||
@ -509,6 +524,7 @@ function DashboardController($scope, $rootScope, $element, $timeout, $mdMedia, $
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
watchWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user