mirror of
https://github.com/nasa/openmct.git
synced 2024-12-29 17:38:53 +00:00
Merge pull request #1232 from nasa/open1216
[Tables] Fixed table scroll by modifying selection of scrollable element. Fixes #1216
This commit is contained in:
commit
cbd001e280
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
define(
|
define(
|
||||||
[],
|
['zepto'],
|
||||||
function () {
|
function ($) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A controller for the MCTTable directive. Populates scope with
|
* A controller for the MCTTable directive. Populates scope with
|
||||||
@ -16,13 +16,13 @@ define(
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.$scope = $scope;
|
this.$scope = $scope;
|
||||||
this.element = element;
|
this.element = $(element[0]);
|
||||||
this.$timeout = $timeout;
|
this.$timeout = $timeout;
|
||||||
this.maxDisplayRows = 50;
|
this.maxDisplayRows = 50;
|
||||||
|
|
||||||
this.scrollable = element.find('div');
|
this.scrollable = this.element.find('.l-view-section.scrolling').first();
|
||||||
this.thead = element.find('thead');
|
this.resultsHeader = this.element.find('.mct-table>thead').first();
|
||||||
this.tbody = element.find('tbody');
|
this.sizingTableBody = this.element.find('.sizing-table>tbody').first();
|
||||||
this.$scope.sizingRow = {};
|
this.$scope.sizingRow = {};
|
||||||
|
|
||||||
this.scrollable.on('scroll', this.onScroll.bind(this));
|
this.scrollable.on('scroll', this.onScroll.bind(this));
|
||||||
@ -261,8 +261,8 @@ define(
|
|||||||
* for individual rows.
|
* for individual rows.
|
||||||
*/
|
*/
|
||||||
MCTTableController.prototype.setElementSizes = function () {
|
MCTTableController.prototype.setElementSizes = function () {
|
||||||
var thead = this.thead,
|
var thead = this.resultsHeader,
|
||||||
tbody = this.tbody,
|
tbody = this.sizingTableBody,
|
||||||
firstRow = tbody.find('tr'),
|
firstRow = tbody.find('tr'),
|
||||||
column = firstRow.find('td'),
|
column = firstRow.find('td'),
|
||||||
headerHeight = thead.prop('offsetHeight'),
|
headerHeight = thead.prop('offsetHeight'),
|
||||||
|
@ -22,9 +22,16 @@
|
|||||||
|
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
|
"zepto",
|
||||||
"../../src/controllers/MCTTableController"
|
"../../src/controllers/MCTTableController"
|
||||||
],
|
],
|
||||||
function (MCTTableController) {
|
function ($, MCTTableController) {
|
||||||
|
|
||||||
|
var MOCK_ELEMENT_TEMPLATE =
|
||||||
|
'<div><div class="l-view-section scrolling">' +
|
||||||
|
'<table class="sizing-table"><tbody></tbody></table>' +
|
||||||
|
'<table class="mct-table"><thead></thead></table>' +
|
||||||
|
'</div></div>';
|
||||||
|
|
||||||
describe('The MCTTable Controller', function () {
|
describe('The MCTTable Controller', function () {
|
||||||
|
|
||||||
@ -55,19 +62,7 @@ define(
|
|||||||
watches[event] = callback;
|
watches[event] = callback;
|
||||||
});
|
});
|
||||||
|
|
||||||
mockElement = jasmine.createSpyObj('element', [
|
mockElement = $(MOCK_ELEMENT_TEMPLATE);
|
||||||
'find',
|
|
||||||
'prop',
|
|
||||||
'on'
|
|
||||||
]);
|
|
||||||
mockElement.find.andReturn(mockElement);
|
|
||||||
mockElement.prop.andReturn(0);
|
|
||||||
mockElement[0] = {
|
|
||||||
scrollTop: 0,
|
|
||||||
scrollHeight: 500,
|
|
||||||
offsetHeight: 1000
|
|
||||||
};
|
|
||||||
|
|
||||||
mockExportService = jasmine.createSpyObj('exportService', [
|
mockExportService = jasmine.createSpyObj('exportService', [
|
||||||
'exportCSV'
|
'exportCSV'
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user