reactjs - 如何更改 React Table 中的单元格宽度
问题描述
我需要在使用 React Table 库时更改单元格宽度,但我对宽度更改的任何想法都失败了。我需要这样做以使“Użytkownik/Rola”列更接近,就在“Status”列附近。我不想使用负值的 margin-left 因为它通常不是推荐的解决方案。通常呈现的宽度大于 style={{}} 中提供的宽度这是它的实现方式:
{
Header: useTranslactionFunc('Status'),
accessor: 'status',
width: 40,
minWidth: 40,
Cell: (props: CellValue) => (
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-start',
marginLeft: '1.5rem',
}}
>
{props.cell.value ? (
<PlayCircleOutlineIcon
style={{
color: theme.palette.success.main,
}}
/>
) : (
<NotInterestedIcon
style={{ color: theme.palette.error.main }}
/>
)}
</div>
),
},
解决方案
我认为该width
属性在使用表格布局时不适用。尝试使用useBlockLayout
钩子。
推荐阅读
- html - 在页面加载开始视图在容器的正确位置,但保留文本 ltr
- python - selenium.common.exceptions.SessionNotCreatedException:消息:无法找到与 GeckoDriver、Selenium 和 Firefox 匹配的一组功能
- python - 无论键的位置如何,都更新字典值
- angular - NgFor 显示最后一个元素
- php - zend框架zend_mail不发送电子邮件
- python - 如何在 Visual Studio 代码中安装 python 3rd 方库?
- git - 我不小心使用 cmd 命令 rd 删除了我的项目。混帐/s/q
- sql-server - Azure SQL:仅在不存在时创建登录用户
- javascript - 同一页面的两个多选字段损坏,vue多选
- tcl - 在过程中声明时无法识别全局变量