IgniteUI / igniteui-angular

Ignite UI for Angular is a complete library of Angular-native, Material-based Angular UI components with the fastest grids and charts, Pivot Grid, Dock Manager, Hierarchical Grid, and more.
https://www.infragistics.com/products/ignite-ui-angular
Other
568 stars 159 forks source link

Grids: provide a more straightforward approach to sort by formatted values #14442

Open ddaribo opened 3 days ago

ddaribo commented 3 days ago

Is your feature request related to a problem? Please describe.

Customers using custom column formatters usually want to sort based on them. Currently the grid sorts by the underlying column values. For filtering on the other hand, it suffices to assign an instance of the FormattedValuesFilteringStrategy to achieve this. The existing approach to override this for sorting is to implement the ISortingStrategy interface, as in this sample. This is a bit lengthy and involves extending the DefaultSortingStrategy just to modify the compareObjects function logic. Moreover, further workarounds have to be implemented if users would like to reuse this custom strategy on multiple formatted columns.

As a side note, this approach is also merely mentioned in the docs here and since a demo is lacking is a question that is often brought up in support cases.

Describe the solution you'd like

Expose a FormattedValuesSortingStrategy, for example.

Describe alternatives you've considered

Additional context