react-table custom cell component that references several row properties

后端 未结 2 666
失恋的感觉
失恋的感觉 2021-02-07 12:14

I need to implement table sorting by column so am rewriting my react table component using react-table\'s ReactTable component.

One of table cells will contain a link an

2条回答
  •  野的像风
    2021-02-07 12:50

    I have had a similar problem and I have solved it as follows:

    Cell: (tableInfo) => `$ {tableInfo.data [tableInfo.row.index] .dateToShow}`
    

    where: tableInfo is an object that has among other things the following attributes: {columns: []}, data: [], comlumn: {}, row: [.], cell: {}} and dateToShow is a value that is not in the view, but exists in the data model. If you need to access data that is in the table view you can use the row object, if it is not in the table view you can access the data model using the data array.

提交回复
热议问题