简体   繁体   English

React & Searchkit 显示更多按钮而不是默认分页

[英]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.我正在处理这个我们正在尝试重新设计的遗留 React 项目,它使用 Searchkit 中的默认分页来查看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?有人熟悉在 2020 年使用 searchkit 吗? I still can't grasp the Accessor concept and extending an Accessor Class or it's methods as: defineAccessor or buildOwnQuery .我仍然无法掌握 Accessor 概念并扩展 Accessor Class 或其方法: defineAccessorbuildOwnQuery
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.我想构建一个从数字开始获取数据并在其上累积的按钮,如果我可以访问 state 或者结果在我自己的商店中,我会这样做,但文档并没有说太多。

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.我使用访问器的onStateChange方法在其他过滤器的任何更改上重置页码,并且在每次结果更改后将存储类型重置为“替换”以供其他过滤器使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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