table icon indicating copy to clipboard operation
table copied to clipboard

getHeaderProps override “click” sortMethod with in react-table

Open hardeep-bit opened this issue 7 years ago • 1 comments

I am using getHeaderProps, I have to change some state when i click on header of react-table,On that click my sortMethod should also work. But its not working.

So On using getHeaderProps, onClick overrides the sortMethod onClick, Therefore sortMethod not working, only getHeaderProps onclick workes.

Now I have Send handleOriginal in onClick as 2nd Parameter but i receive always undefined.

getHeaderProps: (state, rowInfo, column, instance) => {
return {
onClick: (event, handleOriginal) => {
customHeaderSort('conversationStartTime');
        if (handleOriginal) { // always undefiend
          handleOriginal();
        }
      },
    };
  },
},
sortMethod: (current, next) => {
    return tableDataComparator(current, next);
 },

hardeep-bit avatar Jun 28 '19 10:06 hardeep-bit

v6 is no longer being actively maintained. I would suggest asking this question or bringing up this issue in the community forum for more help: https://spectrum.chat/react-table

tannerlinsley avatar Jul 16 '19 19:07 tannerlinsley