react-redux-grid
react-redux-grid copied to clipboard
Edit pageSize number
Hello,
I'm trying to give users the ability to change the pageSize of the grid. I created a state variable : itemsDisplayed. The value is well modified by other part of my code. But unfortunately, even if the render function is called after the update of this state value, the number of items that my grid displays on each page doesn't change.
Here's my code :
var itemsNumber = 5;
if (this.state.itemsDisplayed) {
itemsNumber = this.state.itemsDisplayed;
}
console.log(itemsNumber); // Display 5 then 6 then 7 then 8 after my setState
const gridData = {
columns,
data: data,
pageSize: itemsNumber,
plugins: plugins,
events,
height: this.state.height,
stateKey: 'events'
};
The console proves that my itemsNumber is well updated but the grid always display only the first 5 items as it was defined the first time.
Can you help me? Thank you very much !
I would take a look at the bulk selection example, which is dynamically changing what the pageSize. Here is the code, and here is the actual live example.
Thank you. I'll try to understand it and I'll keep you in touch.
Thank you, didn't understant the utility of getAsyncData but now it's ok !
Thank you for your help
Indeed, it works, but in the example (like in my code) the sorting parameter isn't kept after the getAsyncData. Is there a way to keep it ? Or to re-apply it ?
Thank you very much
@bencripps a question: does change page size work with local data? The example is for remote data.