diff --git a/packages/react-data-grid/src/Cell.js b/packages/react-data-grid/src/Cell.js index 4298af8e57..3ad731ee47 100644 --- a/packages/react-data-grid/src/Cell.js +++ b/packages/react-data-grid/src/Cell.js @@ -174,7 +174,7 @@ class Cell extends React.PureComponent { let extraClasses = joinClasses({ 'row-selected': this.props.isRowSelected, editing: this.isEditorEnabled(), - 'cell-tooltip': this.props.tooltip ? true : false, + 'has-tooltip': this.props.tooltip ? true : false, 'rdg-child-cell': this.props.expandableOptions && this.props.expandableOptions.subRowDetails && this.props.expandableOptions.treeDepth > 0, 'last-column': this.props.column.isLastColumn }); @@ -317,13 +317,20 @@ class Cell extends React.PureComponent { if (treeDepth > 0 && isExpandCell) { cellDeleter = ; } + + const tooltip = this.props.tooltip && ({this.props.tooltip}); + const classes = joinClasses('react-grid-Cell__value', + { 'cell-tooltip': this.props.tooltip ? true : false } + ); + return ( -
+
{cellDeleter}
{CellContent} {this.props.cellControls}
+ {tooltip}
); }; @@ -347,8 +354,7 @@ class Cell extends React.PureComponent { isScrolling }); - let events = this.getEvents(); - const tooltip = this.props.tooltip ? ({this.props.tooltip}) : null; + const events = this.getEvents(); const cellExpander = this.canExpand() && ( @@ -365,7 +371,6 @@ class Cell extends React.PureComponent { {cellActionButtons} {cellExpander} {cellContent} - {tooltip}
); } diff --git a/packages/react-data-grid/src/Row.js b/packages/react-data-grid/src/Row.js index 3d7126cc06..3351313f99 100644 --- a/packages/react-data-grid/src/Row.js +++ b/packages/react-data-grid/src/Row.js @@ -91,7 +91,7 @@ class Row extends React.Component { const { colOverscanStartIdx, colOverscanEndIdx, columns } = this.props; const frozenColumns = columns.filter(c => columnUtils.isFrozen(c)); const nonFrozenColumnsToRender = columns.slice(colOverscanStartIdx, colOverscanEndIdx + 1).filter(c => !columnUtils.isFrozen(c)); - return frozenColumns.concat(nonFrozenColumnsToRender) + return nonFrozenColumnsToRender.concat(frozenColumns) .map(column => this.getCell(column)); }; diff --git a/packages/react-data-grid/src/__tests__/Row.spec.js b/packages/react-data-grid/src/__tests__/Row.spec.js index e5fceb0457..b912785826 100644 --- a/packages/react-data-grid/src/__tests__/Row.spec.js +++ b/packages/react-data-grid/src/__tests__/Row.spec.js @@ -137,13 +137,6 @@ describe('Row', () => { const renderedRange = colOverscanEndIdx - colOverscanStartIdx + 1; expect(cells.length).toBe(renderedRange); }); - - it('first rendered cell index should be first frozen cell', () => { - const columns = lockColumns(LAST_LOCKED_CELL_IDX); - const {cells} = setup({...requiredProperties, columns}); - const firstFrozenColumn = columns.filter(c => c.frozen === true)[0]; - expect(cells.first().props().column).toBe(firstFrozenColumn); - }); }); describe('When not using frozen columns', () => { diff --git a/themes/react-data-grid-cell.css b/themes/react-data-grid-cell.css index de172ec65b..63f99b9a71 100644 --- a/themes/react-data-grid-cell.css +++ b/themes/react-data-grid-cell.css @@ -32,6 +32,15 @@ box-shadow: 2px 0 5px -2px rgba(136, 136, 136, .3) !important; } +/* cell which have tooltips need to have a higher z-index on hover so that the tooltip appears above the other cells*/ +.react-grid-Cell.has-tooltip:hover { + z-index: 5; +} + +.react-grid-Cell.react-grid-Cell--frozen.has-tooltip:hover { + z-index: 15; +} + .react-contextmenu--visible { z-index: 1000; } @@ -90,16 +99,8 @@ padding: 0; } -.cell-tooltip { - position: relative; - display: inline-block; -} - -.cell-tooltip:hover { - z-index: 101; -} - .cell-tooltip .cell-tooltip-text { + white-space: normal; visibility: hidden; width: 150px; background-color: black; @@ -108,12 +109,11 @@ border-radius: 6px; padding: 5px 0; position: absolute; - z-index: 1; - bottom: -150%; + top: 50%; + bottom: initial; left: 50%; - margin-left: -60px; - /* Fade in tooltip - takes 1 second to go from 0% to 100% opacity */ - opacity: 1s; + margin-top: 15px; + margin-left: -75px } .cell-tooltip:hover .cell-tooltip-text {