Skip to content
Discussion options

You must be logged in to vote

For those of you coming here and wondering if I found something, I ended up doing a "nasty hack" with some useEffect and useState to detect the change. It looks like that

const [selectedData, setSelectedData] = useState<readonly T[]>([]);
const selectionColumn = {
    id: 'selection',
    Header: ({
      getToggleAllRowsSelectedProps,
      selectedFlatRows,
    }: UseRowSelectInstanceProps<T>) => {
      // This is a hack to compensate "onRowSelected" missing feature from React Table
      useEffect(() => {
        if (onRowSelection !== undefined) {
          const rows = selectedFlatRows.map(({ original }) => original);
          if (!isEqual(rows, selectedData)) {
            setSele…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by MaximeBernard
Comment options

You must be logged in to vote
3 replies
@MaximeBernard
Comment options

@alessandro308
Comment options

@MaximeBernard
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants