Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Sorting table column #440

Answered by bentleyvk
kmurari103 asked this question in Q&A
Nov 18, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey,
I see you are passing React elements as a data fields. What you should do instead is to use Cell property in column. Also, for sort to work you need to use accessor property in column to pass required field to the Table. Here is the fixed code:

// TableData
function getTableData() {
    (async () => {
      setSmartTableList(await SmartDeviceDecorator.getSmartDeviceData());
    })();
  }
  
//Column 
const tableColumns = React.useMemo(
    ():Columns[] =>
      [
        {
          Header: 'Table',
          columns: [
            {
              Header: '',
              accessor: 'image',
              id: 'image',
              Cell: (props) => {
                return <img src={p…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kmurari103
Comment options

Answer selected by kmurari103
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