您可以使用
debounceInterval
道具选项如下:
<MaterialTable
tableRef={ref => this.tableRef = ref}
title={title}
data={data}
isLoading={store.loading}
options={{...this.options, debounceInterval: 1000}}
actions={this.actions}
localization={this.localization}
columns={this.columns}
components={this.components}
icons={this.icons}
detailPanel={this.rowDetailsPanel}
onChangeRowsPerPage={pageSize => this.handleChangePageSize(pageSize)}
onSearchChange={data => this.handleServerSideSearch(data)}
/>
handleServerSideSearch(dataToSearch) {
console.log(dataToSearch);
// call api here after debounce
}
这将调用
handleServerSideSearch
在最后一次用户搜索交互后1秒。