Opened

Sort by fraction

mdwyer commented

We have a column in the grid that the users would like to see as a fraction, enter as a fraction, and sorty as a fraction. However, sorting does not work correctly. For instance, sorting would be:
1/2
1/4
1/8
3/4

where it should be
1/8
1/4
1/2
3/4

I tried to instead convert that to numeric value behind the scenes and use a display template to display the fraction. However, when they go to edit, it shows the numeric value instead of the fraction.

Ideally, I could tell the column to use the text fraction as the bind, but sort by the numeric version.

Any suggestions?

mladenmacanovic commented

There is not an easy solution. You could do the sort by the behind-the-scene by using the numeric field. But as you already figured it, it becomes hard to edit. Maybe you could also use custom EditTemplate for editing and then convert through the setter of the numeric field?


We actually have the SortField feature planned for the next milestone https://github.com/Megabit/Blazorise/issues/625. We could prioritize it and release it on MyGet as a preview of 0.9.5.

mdwyer commented edited

The sort by would be a great addition as I have had to create work arounds a number of times to try and get similar sorting to work. In this case with fractions it was just much more difficult since they also wanted to edit the field. Looking forward to that addition!

Want to comment on this issue? Log in and write your comment.
Asignee
No assignee
Labels
No Labels