From 7d09c109ac99a652326b13fbb90019a13e90a58b Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Fri, 29 Apr 2016 14:54:54 -0700 Subject: [PATCH] fix(table): Fix row rendering (also fixes focus) - When rendering lazy list, need to pass same reference to the renderer or otherwise a new component will always be mounted --- src/components/table.jsx | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/components/table.jsx b/src/components/table.jsx index 5574179b8..898c0360e 100644 --- a/src/components/table.jsx +++ b/src/components/table.jsx @@ -98,24 +98,25 @@ export default class Table extends Component { CellRenderer: TableCell, } - renderBody() { - const {tableData, rowHeight, bodyHeight, displayNumbers, displayHeader, extraProps, RowRenderer, CellRenderer} = this.props - const rows = displayHeader ? tableData.rows.slice(1) : tableData.rows + renderRow = ({idx}) => { + const {tableData, displayNumbers, displayHeader, extraProps, RowRenderer, CellRenderer} = this.props + const rowIdx = displayHeader ? idx + 1 : idx; + return ( + + ) + } - const itemRenderer = ({idx}) => { - const rowIdx = displayHeader ? idx + 1 : idx; - return ( - - ) - } + renderBody() { + const {tableData, rowHeight, bodyHeight, displayHeader} = this.props + const rows = displayHeader ? tableData.rows.slice(1) : tableData.rows return ( )