angular / angular/components

MatTableDataSource.sortingDataAccessor needs sortDirection

オープン
#13,377 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/table feature P4
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

#### 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?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

MatTableDataSource とその sortingDataAccessor の実装を見つけ、リンク先の StackBlitz の例で動作を再現してください。提案する accessor がソート方向を使用でき、昇順と降順のどちらでも NULL 値が一貫して末尾または先頭に残ることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。