mirror of
https://github.com/nasa/openmct.git
synced 2025-01-04 12:24:10 +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": [
|
"directives": [
|
||||||
{
|
{
|
||||||
"key": "mctDataTable",
|
"key": "mctDataTable",
|
||||||
"implementation": "MCTDataTable.js",
|
"implementation": "directives/MCTDataTable.js",
|
||||||
"depends": [ "$anchorScroll" ]
|
"depends": [ "$anchorScroll" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -22,23 +22,7 @@
|
|||||||
<div class="w1" ng-controller="TelemetryController as telemetry">
|
<div class="w1" ng-controller="TelemetryController as telemetry">
|
||||||
<div class="w2"
|
<div class="w2"
|
||||||
ng-controller="EventListController">
|
ng-controller="EventListController">
|
||||||
<mct-data-table scroll-direction="descending" headers="headers" rows="rows"></mct-data-table>
|
<mct-data-table headers="headers" rows="rows" ascending-scroll="true"></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> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -40,18 +40,18 @@ define(
|
|||||||
scope: {
|
scope: {
|
||||||
headers: "=",
|
headers: "=",
|
||||||
rows: "=",
|
rows: "=",
|
||||||
scrollDirection: "="
|
ascendingScroll: "="
|
||||||
},
|
},
|
||||||
link: function ($scope, $element) {
|
link: function ($scope, $element) {
|
||||||
var currentHeight,
|
var currentHeight,
|
||||||
previousHeight;
|
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
|
// check when elements are added to the table, and move the scroll
|
||||||
// bar accordingly.
|
// bar accordingly.
|
||||||
// (When viewing at the bottom of the page, the scroll bar will
|
// (When viewing at the bottom of the page, the scroll bar will
|
||||||
// stay at the bottom despite additions to the table)
|
// stay at the bottom despite additions to the table)
|
||||||
if ($scope.scrollDirection === "ascending") {
|
if ($scope.ascendingScroll) {
|
||||||
$scope.$watch("rows", function () {
|
$scope.$watch("rows", function () {
|
||||||
// Wait until the page as been repainted (otherwise the
|
// Wait until the page as been repainted (otherwise the
|
||||||
// height will always be zero)
|
// height will always be zero)
|
||||||
@ -60,6 +60,8 @@ define(
|
|||||||
// The offsetHeight of the table body
|
// The offsetHeight of the table body
|
||||||
currentHeight =
|
currentHeight =
|
||||||
$element[0].firstElementChild.firstElementChild.nextElementSibling.offsetHeight;
|
$element[0].firstElementChild.firstElementChild.nextElementSibling.offsetHeight;
|
||||||
|
|
||||||
|
console.log("current height ", currentHeight);
|
||||||
});
|
});
|
||||||
// TODO: Find a more eloquent way to determine repaint completion
|
// TODO: Find a more eloquent way to determine repaint completion
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user