ant-design / ant-design/pro-components

🧐[问题]protable column固定列不自适应宽度(没设置width)

Open
#8,792 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🧐 问题描述

protable column不设置width,可以使单元格自适应,目前不设置width,不能够使固定列自适应宽度,想知道是不是内部布局计算的问题还是其他的问题导致的?

### 💻 示例代码

const columns = [{
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
align: 'center',
render: (_, row) => {
return <>
修改商户

详情

修改电池

删除

}
}]

[
...dom.reverse(),
],
}}
collapsed={false}
toolBarRender={() => []}
request={handleFetchData}
columns={columns}
scroll={{ x: 'max-content' }}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start from the ProTable entry point using the shown fixed-right column, omitted width, and scroll={{ x: 'max-content' }} configuration. Reproduce the layout with the four action buttons and inspect how fixed-column widths are calculated. Done means the fixed column adapts to its content without requiring an explicit width.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.