I'm trying to implement a custom sorting where I try creating an impression of ignoring nulls. From the accepted answer here here's how I would go about doing things:
- Implement a custom sorting function
- In the sorting function I would determine if the sort order is ascending or descending
- If the sort order is ascending I would assign a higher value like 1000 so the null values remain at the bottom.
- If the sort order is descending I would assign a value of -1 so the null values remain at the bottom.
Is there a way to determine the sort order in custom sorting function? I would appreciate if someone knows a better way of solving this problem.