gpt4 book ai didi

javascript - React Table - useRowSelect 更改选择所有默认行为

转载 作者:行者123 更新时间:2023-12-05 06:52:44 24 4
gpt4 key购买 nike

我在我的 React 表中使用选择 Hook ,但找不到覆盖全选复选框行为的方法。When the select all checkbox is checked if you uncheck a specific row in the table it turns the isAllRowsSelected to false.

我希望它仅在单击标题复选框时更改,因为我希望能够显示“所有结果,未标记的结果除外”的状态。

我正在使用服务器端分页,所以我不能只依赖于 selectedRowIds 数组。这是我使用的 useRowSelect 的实现:here

最佳答案

你可以添加这一行,它会在组件挂载时触发。

React.useEffect(()=> {toggleAllRowsSelected()},[])

所有代码如下:codesandbox

关于javascript - React Table - useRowSelect 更改选择所有默认行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65909376/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com