Skip to content

Commit bee362d

Browse files
committed
Try fixing widget overlapping bug
1 parent ba72c66 commit bee362d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

demo/dashboard/view.html

+1-3
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

+4-1
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@
815815
var resize = function() {
816816
var width = $elem[0].offsetWidth || parseInt($elem.css('width'), 10);
817817

818-
if (!width || width === prevWidth || gridster.movingItem) {
818+
if (width === prevWidth || gridster.movingItem) {
819819
return;
820820
}
821821
prevWidth = width;
@@ -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)