Bug 3229 - The "Sort By" feature for lists does not work
Summary: The "Sort By" feature for lists does not work
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact:
URL:
Keywords:
: 3761 5559 (view as bug list)
Depends on: 6402
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-18 03:57 UTC by Chris Cormack
Modified: 2012-10-26 00:40 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch. (6.28 KB, patch)
2009-06-24 01:41 UTC, Chris Cormack
Details | Diff | Splinter Review
Proposed fix (3.05 KB, patch)
2009-12-21 14:22 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:08:04 UTC


---- Reported by debra.denault@liblime.com 2009-05-18 15:57:28 ----

There is the ability to define how lists sort, by title or author, using the "Sort By" feature. It does not currently seem to work (i.e. sort by title or author).



---- Additional Comments From gcollum@gmail.com 2009-06-24 01:41:49 ----

Created an attachment
Proposed patch.

Creates sortfield variables that can be passed so that the sort field can be determined and applied in the jquery tablesorter definition.  



---- Additional Comments From gmcharlt@gmail.com 2009-06-29 19:15:32 ----

Patch pushed.  Please test and close.



---- Additional Comments From debra.denault@liblime.com 2009-07-22 17:55:34 ----

Updated my internal database and tested. Does not seem to be working 100%.

Created a list and added 4 items. Set list to sort by title. It does sort by title now in the OPAC view.

Changed the list to sort by author. The list did not resort by author in the OPAC view.





---- Additional Comments From gcollum@gmail.com 2009-08-06 13:37:44 ----

I played with this last night.  The title sorting using the jquery tablesorter works perfectly in IE, well IE 8, but it does not work in Firefox, Opera, Chrome, or Epiphany.

The problem seems to be the HTML anchors.  The javascript in IE seems to pull out the anchor text, the actually title, for the 'articles' function that is used for sorting, the other browsers do not.  The other browsers are sorting the entire anchor tag, URL + Text.

There are a couple of solutions.
1. Use javascript to pull out the anchor text.  - I didn't get this to work.  I tried a couple of different methods (.text and .innerHTML) but whenever I pulled out the text the sorting did not function within the table at all.

2. Add a name tag that includes the title to the anchors before the href tag.  This works, except the articles are not removed from the title and spaces with the name defined by a name tag are not valid XHTML.  Would adding another variable that includes a title with no leading article and no spaces overkill for this problem?


  



---- Additional Comments From jjeter@ptfs.com 2009-10-13 17:15:38 ----

The Title Sort in the OPAC is not following the filing indicators properly. This appears to be an issue with the browser display and a bug problem.  If you create a List it Sorts properly in FireFox but does not Sort properly in Internet Explorer!



---- Additional Comments From nengard@gmail.com 2009-12-17 01:49:24 ----

This still appears to be a problem



---- Additional Comments From oleonard@myacpl.org 2009-12-21 14:22:24 ----

Created an attachment
Proposed fix

This patch works with the previous one to correct the problem.



---- Additional Comments From oleonard@myacpl.org 2009-12-21 14:24:07 ----

More details about the patch: The javascript-based table sorter is often stymied by white space in table cells. If sorting doesn't work correctly it's often a good thing to check.



---- Additional Comments From oleonard@myacpl.org 2010-02-17 20:40:46 ----

This bug is only fixed under one condition: when there is only one page of list contents and the JavaScript tablesorter is working (i.e. JavaScript is enabled). If JS is turned off the list will be unsorted. If there are multiple pages of results each page of results will be sorted by the JavaScript tablesorter independently of each other.



---- Additional Comments From oleonard@myacpl.org 2010-02-17 20:52:27 ----

In C4/VirtualShelves.pm, GetShelfContents appears to accept "sortfield" as a parameter and tries to find the right sortfield even when it isn't passed. I'm not sure why it isn't using that value to sort the query.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:08 UTC  ---

This bug was previously known as _bug_ 3229 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3229
Imported an attachment (id=1168)
Imported an attachment (id=1169)

Actual time not defined. Setting to 0.0
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here: chris@bigballofwax.co.nz.
   Previous reporter was debra.denault@liblime.com.
CC member jjeter@ptfs.com does not have an account here
CC member jwagner@ptfs.com does not have an account here
CC member kdr@ckls.org does not have an account here
The original submitter of attachment 1168 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1169 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Owen Leonard 2010-07-02 19:59:33 UTC
*** Bug 3761 has been marked as a duplicate of this bug. ***
Comment 2 Owen Leonard 2010-12-30 16:22:08 UTC
*** Bug 5559 has been marked as a duplicate of this bug. ***
Comment 3 Owen Leonard 2011-05-24 16:16:29 UTC
I'm not sure what has changed, but except for the issue raised in Bug 6402 I believe this bug to be fixed now. Changing the sort of a list to 'title' or 'author' results in a correctly-sorted display.