angular / angular/components

MatTableDataSource.sortingDataAccessor needs sortDirection

Ouverte
#13,377 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: material/table feature P4
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Localisez MatTableDataSource et son implémentation de sortingDataAccessor, puis reproduisez le comportement dans l’exemple StackBlitz lié. Confirmez que l’accessor proposé peut utiliser le sens du tri afin que les valeurs NULL restent systématiquement en bas ou en haut, pour les tris ascendants comme descendants.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.