react-redux-grid icon indicating copy to clipboard operation
react-redux-grid copied to clipboard

Paging over local data not working

Open laurenga opened this issue 7 years ago • 5 comments

I built the demo code locally, changed the 'pagingType' of the PAGER to 'local' and set a 'pageSize' of 5. When I ran the modified demo the 'local' pager doesn't work. The grid only shows the first page of data.

laurenga avatar Feb 02 '18 01:02 laurenga

I think if you take a look at the simple example, you should find what you need. This uses locally paged data.

bencripps avatar Feb 04 '18 02:02 bencripps

I tried out the simple example and I've seen the documentation that notes the pagination plugin should default to enabled with a pagingType of 'local', however, this appears to be having issue.

I find that if the PAGER plugin is not specified as enabled then no paging toolbar shows up.

If I try PAGER: {enabled: true, pagingType: 'local'} then I do see the paging toolbar. When clicking next I see the PAGE_LOCAL action fired but the data in the grid doesn't change

laurenga avatar Feb 05 '18 18:02 laurenga

@laurenga I am experiencing the same issue. The PAGE_LOCAL action was dispatched properly but page did not seem to move as expected. Below is my code:

// export const BUTTON_TYPES = { NEXT: 'next', BACK: 'back' }; // const action = { index: this.state.activePage * 1 + 1, type: ReactReduxGrid.ActionTypes.PAGE_LOCAL, BUTTON_TYPES: btnTypes }; // this.context.store.dispatch ( Actions.PagerActions.setPage(action) ); @bencripps would it be possible to provide a practical example on local pagination?

GOVYANSONG avatar Feb 23 '18 20:02 GOVYANSONG

@bencripps I did more digging in the documentation and source code. My question now is: in local data mode, is stateKey required when dispatch action PAGE_LOCAL? I guess not because no parameter is reserved for it. In this light, how is local grid identified then? A bit confused

GOVYANSONG avatar Feb 24 '18 02:02 GOVYANSONG

export const setPage = ({ index, type, BUTTON_TYPES }) => { //in this action it does not take in the state key, but from the button it is send store.dispatch( setPage({ index: pageIndex, type, BUTTON_TYPES, stateKey }) );

is this the reason that the next button on local data does not work? @bencripps It also doesnt work in the simple example, fyi.

I tried to solve this myself however I didnt understand what this reducer does, its different from how I normally make reducers in redux

Rohmin avatar Jul 23 '18 12:07 Rohmin