From 778cadd5422b79824f3915f7b0e16282f84fb410 Mon Sep 17 00:00:00 2001 From: Your NameSajRashid Date: Tue, 27 Jul 2021 08:58:49 +0100 Subject: [PATCH] bugfix pageSize --- src/components/react-dj-table/package.json | 2 +- src/components/react-dj-table/reducers/tableReducer.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/react-dj-table/package.json b/src/components/react-dj-table/package.json index 6cc0c85..1812c7a 100644 --- a/src/components/react-dj-table/package.json +++ b/src/components/react-dj-table/package.json @@ -1,6 +1,6 @@ { "name": "react-dj-table", - "version": "1.1.15", + "version": "1.1.16", "description": "React Dynamic Resposive Json HTML Table", "main": "index.js", "scripts": { diff --git a/src/components/react-dj-table/reducers/tableReducer.js b/src/components/react-dj-table/reducers/tableReducer.js index 8697381..d89dbdd 100644 --- a/src/components/react-dj-table/reducers/tableReducer.js +++ b/src/components/react-dj-table/reducers/tableReducer.js @@ -40,7 +40,8 @@ export const TableReducer = (state, action) => { return { ...state } case ACTIONS.ITEMSPERPAGE: resetRows() - state.totalPages = Math.ceil(state.jsonCopy.length / action.payload.itemsPerPage) + state.pageSize = action.payload.itemsPerPage + state.totalPages = Math.ceil(state.jsonCopy.length / state.pageSize) state.pageNo = 1 if (action.payload.itemsPerPage) { state.json = paginate(state.jsonCopy || [], state.pageSize, 0)