问题描述
反应表排序具有3个条件,default view
,ascending
和descending
,如其官方样本https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sorting所示
现在,我只想使其位于ascending
和descending
之间,并删除默认视图。我尝试默认对第一列进行排序
useTable(
{
columns,data,initialState: {
pageIndex: 0,pageSize: 10,sortBy: [
{
id: "asset",desc: false,},],)
,但是当我单击该列并且不知道如何删除它时,默认视图仍然存在。我也不能在他们的文档中找到它。
解决方法
useSortBy documentation提到了在调用useTable时可以指定的disableSortRemove选项。
如果为true,则对列进行排序后将无法使用未排序状态。