Skip to content

Commit ac63f0c

Browse files
committed
Try fixing widget width === 0 bug
1 parent ba72c66 commit ac63f0c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

demo/dashboard/view.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1 style="display: inline-block; width: 200px;">Dashboard</h1>
55
<select class="form-control" style="width: 150px; margin-bottom: 20px; display:inline-block;" ng-change="changeDashboard()" ng-model="selectedDashboardId" ng-options="d.id as d.name for d in dashboards | object2Array | orderBy:'id'">
66
</select>
77
</div>
8-
<div gridster="gridsterOptions" ng-show="visible">
8+
<div gridster="gridsterOptions" ng-show="dashboard.widgets.length">
99
<ul>
1010
<li gridster-item="widget" ng-repeat="widget in dashboard.widgets">
1111
<div class="box" ng-controller="CustomWidgetCtrl">
@@ -22,5 +22,3 @@ <h3>{{ widget.name }}</h3>
2222
</li>
2323
</ul>
2424
</div>
25-
<hr>
26-
<button ng-click="visible=!visible">toggle</button>

src/angular-gridster.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@
831831
}
832832

833833
$rootScope.$broadcast('gridster-resized', [width, $elem[0].offsetHeight], gridster);
834+
$scope.$apply();
834835
};
835836

836837
// track element width changes any way we can
@@ -845,6 +846,8 @@
845846

846847
// allow a little time to place items before floating up
847848
$timeout(function() {
849+
resize();
850+
848851
scope.$watch('gridster.floating', function() {
849852
gridster.floatItemsUp();
850853
});

0 commit comments

Comments
 (0)