React-table: Manual sorting still triggering row sort

Created on 9 Dec 2019  路  4Comments  路  Source: tannerlinsley/react-table

Describe the bug

I added the manualSorting flag to my table setup to be able to use server side sorting, as stated in the documentation:

Enables sorting detection functionality, but does not automatically perform row sorting. Turn this on if you wish to implement your own sorting outside of the table (eg. server-side or manual row grouping/nesting)

To Reproduce

  const {
    pageOptions,
    previousPage,
    nextPage,
    state: { pageIndex, pageSize, sortBy },
    getTableProps,
    getTableBodyProps,
    headerGroups,
    page,
    prepareRow,
    canPreviousPage,
    canNextPage,
    setPageSize,
    gotoPage,
  } = useTable(
    {
      columns,
      data,
      initialState: { pageSize: 10 },
      disableMultiSort: true,
      manualSorting: true,
    },
    useSortBy,
    usePagination,
  );

Expected behavior

As the documentation states, I expect the internal state to be updated but no actual sorting taking place until I manually trigger it.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Mac OS X Catalina
  • Browser [e.g. chrome, safari] Chrome

Most helpful comment

can you share an example of how to implement server-side sorting

All 4 comments

Hmmm. Do you have a codesandbox I can look at that exhibits this bug?

Also, make sure you're using the latest version of the library, and take note that manualSorting was renamed to manualSortBy recently.

Sorry for the late reply but renaming the prop to manualSortBy did the trick! Thanks for the help!

can you share an example of how to implement server-side sorting

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Codar97 picture Codar97  路  3Comments

kieronsutton00 picture kieronsutton00  路  3Comments

alexanderwhatley picture alexanderwhatley  路  3Comments

ocalde picture ocalde  路  3Comments

DaveyEdwards picture DaveyEdwards  路  3Comments