MatTableDataSource.sortingDataAccessor needs sortDirection
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
#### 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?
Guía de contribución
Línea de trabajo
Localiza MatTableDataSource y su implementación de sortingDataAccessor, y luego reproduce el comportamiento en el ejemplo vinculado de StackBlitz. Confirma que el accessor propuesto puede usar la dirección de ordenación para que los valores NULL permanezcan consistentemente al final o al principio tanto en orden ascendente como descendente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100