[Mantis ref. MT2062] In Home › Patrons › Search Results, the results are always sorted by name. There is a listbox "order by" allowing 2 choices: 1) Surname. When searching with this choice, the results are indeed sorted by surname. 2) Cardnumber. When searching with this choice, the results seem to be sorted by first name. ===== What is exactly the problem then? A) Should we be able to sort by first name/surname and then Cardnumber must be renamed to First name? B) Should we be able to sort by surname/cardnumber and then the sorting must be repaired for the cardnumber option? C) Should we be able to sort by first name/surname/cardnumber and then we add a new choice and repair cardnumber?
It looks to me like the server-side sort of the whole result set is working fine but the client-side javascript sorts by name by default. I don't think having a client-side sort makes much sense for sorted paged results, so perhaps the answer (pending a conversion to datatables) is to remove the table sorter.
Indeed! Didn't think I would find a client-side sort here!! I don't see the point, I'll thus delete the following part: <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> <script type="text/javascript">//<![CDATA[ $(document).ready(function() { $("#memberresultst").tablesorter({ sortList: [[1,0]], widgets: ['zebra'] }); }); //]]> </script> (it seems to work ok without it)
Created attachment 6752 [details] [review] proposed patch Removed the tablesort JS.
We lose something with this patch, the widget ['zebra'] is needed to give a different color to uneven lines. I'll make another patch deleting only the "sortList: [[1,0]]," line.
Why not move the table row coloring to the markup instead? [% IF ( loop.even ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
Actually, there is already something like that in the template, the highlights look ok. No problem then, the patch is fine.
Created attachment 6809 [details] [review] [SIGNED-OFF] Bug 7349: corrects sort order for Patron search Sorting by cardnumber now works (removed a client-side sort, the server-side sort is enough). Signed-off-by: Koustubha Kale <kmkale@anantcorp.com> 1) Verified that before applying this patch, when searching patrons with cardnumber as order by preference, patrons are sorted ny name. 2) Verified that after applying this patch, when searching with cardnumber as order by preference, patrons are correctly sorted by cardnumber.
Template only change, removes JS block only. Marking as Passed QA
QA comment: this patch removes code only, that can't be wrong ;-) patch pushed, please test
*** Bug 7066 has been marked as a duplicate of this bug. ***