angular / angular/components

Support inserting row/column defs at specific indices rather than always appending

Đang mở
#21,791 7 bình luận 2 reaction 0 người được giao Xem trên GitHub
area: cdk/table feature P4
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

#### What are you trying to do?

I'm trying to make table with 2 sticky header rows. First row should contain toolbar with table actions, but definition of this row is in separated file, it is passed through `cdkTable.addHeaderRowDef` . Second row should contain descriptions of columns.

#### What troubleshooting steps have you tried?

I tried to manually position `headerRowDefinition` inside `_headerRowDefs` property, but I'm unable to do that due to:
https://github.com/angular/components/blob/d3deb8b9c61f79f6a4ab75d74914aac3b43592bf/src/cdk/table/table.ts#L895
contentHeaderRowDefinitions specified explicit as content are always before customHeaderRowDefinitions added via `addHeaderRowDef`.

I tried to handle stickness by styling headers `postion: sticky` and calculate top positioning, but I'm unable to do that due to: https://github.com/angular/components/blob/d3deb8b9c61f79f6a4ab75d74914aac3b43592bf/src/cdk/table/table.ts#L731
All header rows have cleared top positioning value that I set via styling.

#### Reproduction
https://stackblitz.com/edit/angular-bkarpk?file=src/app/table/table.component.html

#### Environment

- Angular: 11.1.1
- CDK/Material: 11.1.1
- Browser(s): Chrome/Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với các phần được liên kết của src/cdk/table/table.ts và chạy bản tái hiện StackBlitz được cung cấp. Theo dõi cách nội dung và các định nghĩa hàng tiêu đề tùy chỉnh được sắp xếp, cũng như cách vị trí cố định của tiêu đề được xóa. Hoàn thành khi các định nghĩa tiêu đề có thể xuất hiện tại chỉ mục được yêu cầu và hai hàng tiêu đề cố định vẫn giữ đúng vị trí.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
30/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.