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