lundi 1 avril 2019

Why is not showing the order indicator arrow in a ransack sort_link?

When I use for example:

    <%= simple_sort_link(medical_test_orders_meta, :description, {default_order: :desc}) %>

...it shows the order indicator arrow. But when I use:

      <%#= sort_link(medical_test_orders_meta, humanize_attribute(medical_test_order_model, :patient), %i(patient_first_name patient_middle_name patient_last_name), {default_order: :desc}) %>

... it doesn't shows the order indicator arrow. It orders first by the first name, then by the middle name, and finally by the last name.

I have tried with several combinations/variants and so far some of them order but do not show the arrow, and others show it but do not order at all.

I have solved the problem very easily using JavaScript/jQuery (please don't mention that kind of solutions), but I would like to know if there is a better/cleaner way to solve this using: rails and/or passing other kind of parameters to the ransack sort_link, etc, etc. I don't like using all that JavaScript code for just an order indicator arrow but on the other hand I like the perfection at all cost, so... HELP PLEASE!!

Aucun commentaire:

Enregistrer un commentaire