komarovalexander / ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Virtualization, Editing and many more

Home Page:http://ka-table.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting doesn't work if custom header component

aleksei-baryshnikov opened this issue · comments

If using a custom header cell component then it won't work.

Example:
https://stackblitz.com/edit/table-custom-header-cell-ts-a3crzg?file=Demo.tsx

Hi @aleksei-baryshnikov
headCell overrides the whole head component and its behavior
you have 2 ways to make it work:

  1. use headCellContent instead https://stackblitz.com/edit/table-custom-header-cell-ts-vkmq6n?file=Demo.tsx
    OR
  2. add onClick and dispatch the required action: https://stackblitz.com/edit/table-custom-header-cell-ts-xfhmuf?file=Demo.tsx

best regards