silevis / reactgrid

Add spreadsheet-like behavior to your React app
https://reactgrid.com
MIT License
1.27k stars 137 forks source link

Request for Code Revision: Enable Column Width Resizing for Merged Header Cells #446

Open risa-999 opened 1 month ago

risa-999 commented 1 month ago

Describe the bug This is not a bug report, but a request for a code revision.

Current behavior Currently, resizing the column width can only be done in the first row where row.idx=0.

Expected behavior We would like to resize the column width for header-type cells.
We have merged the first and second rows to create header cells, but the ResizeHandle only appears on the first row, making it impossible to resize the column by selecting the second row.
Could you please modify it so that header-type cells can be resized even if they are not in the first row?

I think the following sections should be modified:
File: CellRenderer.tsx, line 137
{(location.row.idx === 0 || cell.type === 'header') && location.column.resizable && <ResizeHandle />}

File: DefaultBehavior.ts, line 60
// location.row.idx === 0 &&

If there are no impacts on other parts of the code, I would appreciate it if you could make the changes.

Screenshots or gifs The column width can be resized in the first row, but it cannot be resized in the second row.
1_idx0_ok 1_idx1_ng 2_idx1_ng

Your environment details

qiufeihong2018 commented 2 days ago

Which version are you using?

risa-999 commented 1 day ago

@silevis/reactgrid@^4.0.4": version "4.0.4"