angular / angular/components

MatTableDataSource.sortingDataAccessor needs sortDirection

Đang mở
#13,377 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/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ả

#### Bug, feature request, or proposal:

Feature request

Enhance MatTableDataSource.sortingDataAccessor with sortDirection parameter to allow for better sort customization.

#### What is the expected behavior?

For example being able to define a sortingDataAccessor to *always* sort NULL values to the bottom (or top for that matter) regardless if 'asc' or 'desc'

#### What is the current behavior?

Null values are interpreted as 0 (zero) in case of numeric properties.

#### What are the steps to reproduce?

https://angular-8ubc1i.stackblitz.io

#### What is the use-case or motivation for changing an existing behavior?

I have a list of objects with various numeric properties, some of which are NULL.

I'd like to write a sortingDataAccessor to ALWAYS sort NULL values to the bottom regardless of 'asc' or 'desc' (since NULL is irrelevant/meaningless for our sort)
For this I seem to need a sortDirection in the sortingDataAccessor to either return min or max 'infinity' for NULL values.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?

6.4.7

#### Is there anything else we should know?

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

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

Hướng nghiên cứu

Xác định MatTableDataSource và phần triển khai sortingDataAccessor của nó, sau đó tái hiện hành vi trong ví dụ StackBlitz được liên kết. Xác nhận rằng accessor được đề xuất có thể sử dụng hướng sắp xếp để các giá trị NULL luôn nằm nhất quán ở cuối hoặc đầu đối với cả sắp xếp tăng dần và giảm dần.

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
42/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.