diff --git a/source/Table/Table.jest.js b/source/Table/Table.jest.js index d31ce1c53..e2b2bd007 100644 --- a/source/Table/Table.jest.js +++ b/source/Table/Table.jest.js @@ -259,7 +259,7 @@ describe('Table', () => { describe('forceUpdateGrid', () => { it('should refresh inner Grid content when called', () => { let marker = 'a' - function cellRenderer ({ cellData, columnData, dataKey, rowData, rowIndex }) { + function cellRenderer ({ cellData, columnData, dataKey, rowData, rowIndex, columnIndex }) { return `${rowIndex}${marker}` } const component = render(getMarkup({ cellRenderer })) @@ -284,7 +284,7 @@ describe('Table', () => { it('should use a custom cellRenderer if specified', () => { const rendered = findDOMNode(render(getMarkup({ - cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex }) => `Custom ${cellData}` + cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex, columnIndex }) => `Custom ${cellData}` }))) const nameColumns = rendered.querySelectorAll('.ReactVirtualized__Table__rowColumn:first-of-type') Array.from(nameColumns).forEach((nameColumn, index) => { @@ -295,7 +295,7 @@ describe('Table', () => { it('should set the rendered cell content as the cell :title if it is a string', () => { const rendered = findDOMNode(render(getMarkup({ - cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex }) => 'Custom' + cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex, columnIndex }) => 'Custom' }))) const nameColumn = rendered.querySelector('.ReactVirtualized__Table__rowColumn:first-of-type') expect(nameColumn.getAttribute('title')).toContain('Custom') @@ -303,7 +303,7 @@ describe('Table', () => { it('should not set a cell :title if the rendered cell content is not a string', () => { const rendered = findDOMNode(render(getMarkup({ - cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex }) =>
Custom
+ cellRenderer: ({ cellData, columnData, dataKey, rowData, rowIndex, columnIndex }) =>
Custom
}))) const nameColumn = rendered.querySelector('.ReactVirtualized__Table__rowColumn:first-of-type') expect(nameColumn.getAttribute('title')).toEqual(null) diff --git a/source/Table/Table.js b/source/Table/Table.js index dd6a3716f..b4869c932 100644 --- a/source/Table/Table.js +++ b/source/Table/Table.js @@ -388,7 +388,7 @@ export default class Table extends PureComponent { } = column.props const cellData = cellDataGetter({ columnData, dataKey, rowData }) - const renderedCell = cellRenderer({ cellData, columnData, dataKey, isScrolling, parent, rowData, rowIndex }) + const renderedCell = cellRenderer({ cellData, columnData, dataKey, isScrolling, parent, rowData, rowIndex, columnIndex }) const style = this._cachedColumnStyles[columnIndex] diff --git a/source/Table/defaultCellRenderer.js b/source/Table/defaultCellRenderer.js index 4ba19dbbc..048f582b6 100644 --- a/source/Table/defaultCellRenderer.js +++ b/source/Table/defaultCellRenderer.js @@ -10,7 +10,8 @@ export default function defaultCellRenderer ({ columnData, dataKey, rowData, - rowIndex + rowIndex, + columnIndex }: CellRendererParams): string { if (cellData == null) { return ''