diff --git a/src/scrollWrapper/index.js b/src/scrollWrapper/index.js index 82922c9..72a8e5d 100644 --- a/src/scrollWrapper/index.js +++ b/src/scrollWrapper/index.js @@ -409,7 +409,9 @@ class SpreadsheetGridScrollWrapper extends React.PureComponent { } render() { - const rows = slice(this.props.rows, this.state.first, this.state.last) + const rows = this.props.isScrollable + ? slice(this.props.rows, this.state.first, this.state.last) + : this.props.rows return (
diff --git a/stories/index.js b/stories/index.js index bbbeafd..d1dfc22 100644 --- a/stories/index.js +++ b/stories/index.js @@ -7,7 +7,7 @@ import { Grid, Input, Select } from './../index' const rows = [] const positions = [] -for (let i = 0; i < 1000; i++) { +for (let i = 0; i < 10; i++) { rows.push({ id: i, firstName: 'First name ' + i, @@ -32,6 +32,18 @@ function DataTable(props) { setRows([].concat(rows)) } + const addRow = () => { + const id = [...rows][rows.length - 1].id + 1 + const newRow = { + id: id, + firstName: 'First name ' + i, + secondName: 'Second name ' + i, + positionId: 3, + } + + setRows(rows.concat(newRow)) + } + const initColumns = () => { return [ { @@ -103,20 +115,23 @@ function DataTable(props) { } return ( -
- row.id} - rowHeight={50} - isColumnsResizable - onColumnResize={onColumnResize} - focusOnSingleClick={props.focusOnSingleClick} - disabledCellChecker={(row, columnId) => { - return columnId === 'age' - }} - isScrollable={props.isScrollable} - /> +
+ +
+ row.id} + rowHeight={50} + isColumnsResizable + onColumnResize={onColumnResize} + focusOnSingleClick={props.focusOnSingleClick} + disabledCellChecker={(row, columnId) => { + return columnId === 'age' + }} + isScrollable={props.isScrollable} + /> +
) }