Bri Prebilic Cole

GUI -- Table scrolling fixed header directive no longer depends on a timeout function.

- Added a general directive that emits when ng-repeat is completed.

Change-Id: I23131adecded9f0393334d003812845ac6b4f031
......@@ -70,5 +70,14 @@
}
};
}])
// create a general ng-repeat complete notifier directive
.directive('ngRepeatDone', [function () {
return function (scope, element, attrs) {
if(scope.$last) {
scope.$emit('LastElement');
}
}
}]);
}());
......
......@@ -113,7 +113,6 @@
};
}])
// TODO: find another solution other than timeout for waiting for ng-repeat to end
.directive('onosFixedHeader', ['$window', '$timeout',
'MastService', 'FnService',
function (_$window_, $timeout, mast, _fs_) {
......@@ -121,7 +120,8 @@
$window = _$window_;
fs = _fs_;
var w = angular.element($window),
table = d3.select(element[0]);
table = d3.select(element[0]),
shouldResize = false;
scope.$watch(function () {
return {
......@@ -136,10 +136,16 @@
scope.windowWidth = newVal.w;
scope.setTableHW = function () {
$timeout(function () {
scope.$on('LastElement', function (event) {
fixTable(table, thead, tbody);
}, 250);
shouldResize = true;
});
};
if (shouldResize) {
fixTable(table, thead, tbody);
}
}, true);
w.bind('onos-fixed-header', function () {
......
......@@ -18,7 +18,8 @@
</thead>
<tbody>
<tr ng-repeat="dev in ctrl.deviceData">
<tr ng-repeat="dev in ctrl.deviceData"
ng-repeat-done>
<td><div icon icon-id="{{dev._iconid_available}}"></div></td>
<td>{{dev.id}}</td>
<td>{{dev.mfr}}</td>
......