【问题标题】:How to use server side pagination with client filtration?如何在客户端过滤中使用服务器端分页?
【发布时间】:2020-01-19 13:52:15
【问题描述】:

我需要的是当我使用远程数据时,我希望被允许过滤客户端而不是服务器端这是我的表

还有我的remote data代码

 <MaterialTable
   title={Strings.userManagementList}
   data={query => {
     this.get(query);
     return new Promise(resolve => event.on('data-fetched', resolve));
    }}
    isLoading={store.loading}
    options={this.options}
    actions={this.actions}
    localization={this.localization}
    columns={this.columns}
    components={this.components}
  />

这很好用,但左上角的搜索栏when i type in it, it calls the end point agin with search parameter ---> 这很正常,但我的问题是 when i change filter or search from search bar ---&gt; related to any column it also calls the endpoint

所以我想要的是: 1/ 远程数据 2/ 仅用于再次触发远程数据的左上角搜索字段 3/如果我从列过滤栏过滤它在当前表结果中搜索不需要远程数据,除非我从左上角搜索字段分页或搜索

提前致谢。

【问题讨论】:

    标签: material-table


    【解决方案1】:

    您可以通过将查询返回的数据本地保存在组件中来做到这一点。

    现在如果只有查询的过滤器而不是页面或搜索参数发生变化,而不是调用this.get(query);,您访问本地保存的数据,通过查询对象中的过滤器文本过滤并返回过滤后的数据数据而不是获取新数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-15
      相关资源
      最近更新 更多