From cd33d04481baca51138e4c5e815bc3a9abdd74c7 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Wed, 4 Sep 2019 14:43:41 +0400 Subject: [PATCH] add prop to disable pagination in table component --- src/components/Table/index.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/Table/index.jsx b/src/components/Table/index.jsx index e24639b1..577277aa 100644 --- a/src/components/Table/index.jsx +++ b/src/components/Table/index.jsx @@ -162,10 +162,11 @@ class GnoTable extends React.Component, State> { input: classes.white, } - const sortedData = stableSort(data, getSorting(orderParam, orderByParam, orderProp), fixedParam).slice( - page * rowsPerPage, - page * rowsPerPage + rowsPerPage, - ) + let sortedData = stableSort(data, getSorting(orderParam, orderByParam, orderProp), fixedParam) + + if (!disablePagination) { + sortedData = sortedData.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage) + } const emptyRows = rowsPerPage - Math.min(rowsPerPage, data.length - page * rowsPerPage) const isEmpty = size === 0