简体   繁体   中英

React & Searchkit Show More Button instead of default pagination

I'm working on this legacy React project which we're trying to redesign, it was using default Pagination in Searchkit to view results from Elasticsearch.
Now for redesign purposes we need to replace it with a "Show More button" instead of clicking on the page number.

Is anyone familiar with using searchkit in 2020? I still can't grasp the Accessor concept and extending an Accessor Class or it's methods as: defineAccessor or buildOwnQuery .
I want to build a button that fetches data starting from a number and accumulates on it, if i have access to state or the results are in my own store i would've done that but the docs don't say much.

I figured a solution by storing results onResultsChange and default storing type is to "replace", and on Clicking on "Load More" button the storage type will be changed to "push" new results.
I used accessor's onStateChange method to reset page number on any change by other filters, and after each result change will reset the storage type back to "replace" to be used by other filters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM