MatTableDataSource.sortingDataAccessor needs sortDirection
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
#### 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?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Individua MatTableDataSource e la relativa implementazione di sortingDataAccessor, quindi riproduci il comportamento nell’esempio StackBlitz collegato. Verifica che l’accessor proposto possa usare la direzione di ordinamento, in modo che i valori NULL rimangano costantemente in fondo o in cima sia per gli ordinamenti ascendenti sia per quelli discendenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100