如何更改tanstack React Table useSelectRow的ID

问题描述

嗨,我只是在tanstack React Table上进行构建批量删除的实验 问题是这里我无法更改所选列的ID

为什么要更改此设置?
因为我想要可以发送到服务器的MongoDB ID。
selectedRowIds方法

enter image description here

这里有一些钩子代码

hooks => {
            hooks.visibleColumns.push(columns => [
                // Let's make a column for selection
                {
                    id: 'selection',// accessor: '_id',// The header can use the table's getToggleAllRowsSelectedProps method
                    // to render a checkbox
                    Header: ({ getToggleAllRowsSelectedProps }) => (
                        <div>
                            <IndeterminateCheckbox {...getToggleAllRowsSelectedProps()} />
                        </div>
                    ),// The   cell can use the individual row's getToggleRowSelectedProps method
                    // to the render a checkbox
                    Cell: ({ row }) => {
                        console.log(row)
                        return <div>
                            <IndeterminateCheckbox {...row.getToggleRowSelectedProps()} />
                        </div>

                    },},...columns,])

所有参考文献均来自main documentation

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)