diff --git a/client/app/scripts/components/node-details/node-details-table.js b/client/app/scripts/components/node-details/node-details-table.js index 0bd1109dd..bb5ca3307 100644 --- a/client/app/scripts/components/node-details/node-details-table.js +++ b/client/app/scripts/components/node-details/node-details-table.js @@ -145,6 +145,7 @@ class NodeDetailsTable extends React.Component { this.onMouseLeaveRow = this.onMouseLeaveRow.bind(this); this.onMouseEnterRow = this.onMouseEnterRow.bind(this); this.saveTableContentRef = this.saveTableContentRef.bind(this); + this.saveTableHeadRef = this.saveTableHeadRef.bind(this); // Use debouncing to prevent event flooding when e.g. crossing fast with mouse cursor // over the whole table. That would be expensive as each focus causes table to rerender. this.debouncedFocusRow = debounce(this.focusRow, TABLE_ROW_FOCUS_DEBOUNCE_INTERVAL); @@ -172,7 +173,7 @@ class NodeDetailsTable extends React.Component { this.focusState = { focusedNode: node, focusedRowIndex: rowIndex, - tableContentMinHeightConstraint: this.tableContent && this.tableContent.scrollHeight, + tableContentMinHeightConstraint: this.tableContentRef && this.tableContentRef.scrollHeight, }; } @@ -192,7 +193,11 @@ class NodeDetailsTable extends React.Component { } saveTableContentRef(ref) { - this.tableContent = ref; + this.tableContentRef = ref; + } + + saveTableHeadRef(ref) { + this.tableHeadRef = ref; } getColumnHeaders() { @@ -200,6 +205,11 @@ class NodeDetailsTable extends React.Component { return [{id: 'label', label: this.props.label}].concat(columns); } + componentDidMount() { + const scrollbarWidth = this.tableContentRef.offsetWidth - this.tableContentRef.clientWidth; + this.tableHeadRef.style.paddingRight = `${scrollbarWidth}px`; + } + render() { const { nodeIdKey, columns, topologyId, onClickRow, @@ -250,7 +260,7 @@ class NodeDetailsTable extends React.Component {