mirror of
https://github.com/nasa/openmct.git
synced 2025-01-01 19:06:40 +00:00
[Events] Changed directive variables
Changed scrollDirection to ascendingScroll, which acts like a boolean. Now there is proper communication between the html and the directive itself. #18.
This commit is contained in:
parent
3337777fea
commit
fdab799e5b
@ -23,7 +23,7 @@
|
||||
"directives": [
|
||||
{
|
||||
"key": "mctDataTable",
|
||||
"implementation": "MCTDataTable.js",
|
||||
"implementation": "directives/MCTDataTable.js",
|
||||
"depends": [ "$anchorScroll" ]
|
||||
}
|
||||
]
|
||||
|
@ -22,23 +22,7 @@
|
||||
<div class="w1" ng-controller="TelemetryController as telemetry">
|
||||
<div class="w2"
|
||||
ng-controller="EventListController">
|
||||
<mct-data-table scroll-direction="descending" headers="headers" rows="rows"></mct-data-table>
|
||||
<!-- <table class="tabular">
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-repeat="header in headers">
|
||||
{{header}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="row in rows">
|
||||
<td ng-repeat="cell in row">
|
||||
{{cell}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table> -->
|
||||
<mct-data-table headers="headers" rows="rows" ascending-scroll="true"></mct-data-table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -40,18 +40,18 @@ define(
|
||||
scope: {
|
||||
headers: "=",
|
||||
rows: "=",
|
||||
scrollDirection: "="
|
||||
ascendingScroll: "="
|
||||
},
|
||||
link: function ($scope, $element) {
|
||||
var currentHeight,
|
||||
previousHeight;
|
||||
|
||||
// If the chosen scoll ascending is descending, we want to
|
||||
// If the scroll is set to ascending, we want to
|
||||
// check when elements are added to the table, and move the scroll
|
||||
// bar accordingly.
|
||||
// (When viewing at the bottom of the page, the scroll bar will
|
||||
// stay at the bottom despite additions to the table)
|
||||
if ($scope.scrollDirection === "ascending") {
|
||||
if ($scope.ascendingScroll) {
|
||||
$scope.$watch("rows", function () {
|
||||
// Wait until the page as been repainted (otherwise the
|
||||
// height will always be zero)
|
||||
@ -60,6 +60,8 @@ define(
|
||||
// The offsetHeight of the table body
|
||||
currentHeight =
|
||||
$element[0].firstElementChild.firstElementChild.nextElementSibling.offsetHeight;
|
||||
|
||||
console.log("current height ", currentHeight);
|
||||
});
|
||||
// TODO: Find a more eloquent way to determine repaint completion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user