Tables no longer sortable

Issue #608 resolved
Tim de Wit created an issue

E.g. on "display names & modality" page. Worked earlier but seems to be broken (0.8.0b1 release).

Comments (24)

  1. Ed McDonagh

    My fault. I will have broken it when I moved the code to an AJAX loading.

    If anyone fancies fixing it please do!

  2. Ed McDonagh

    HI @tcdewit, @dplatten - with my non-javascripty brain, it isn't immediately obvious why this no longer works. I expect it is to do with the fact that the tables are not there when the page is loaded, but I'm not sure how to fix it.

  3. Ed McDonagh

    Thrown it onto testing, and it works nicely. Thanks.

    Now though, I'm thinking we should put a sortable custom key in to the how many studies column to sort on the date of the last item - that is something I have found myself wanting to sort by (within a single x-ray source) several times - mainly to see which version of software a scanner is on!

  4. David Platten

    The table shown to the user in the review_summary_list.html has two heading rows, the first contains:

    General; Patient module; CT data; DX/RF/MG; Accumulated data; Irradiation event data

    The second contains:

    Date; Time; General; Study; Template; Accumulated; Events; Template; Accumulated; Fluoro & DX; Mammography; Cassette based Projection; General; Detector; Source; Mechanical

    Because of these two header rows the sorting doesn't really work, so I'm going to remove it for this page.

  5. David Platten

    Removed the (broken) sorting from the review_summary_list template. Even when I fixed the break caused by the AJAX the sorting still doesn't work due to the table having two header rows. References issue #608.

    → <<cset ac6cc6bc7990>>

  6. Ed McDonagh

    I think the sorttable.js is there at the top because I copied your page rather than because I was using it. The table itself doesn't have the sortable style.

    So I think it is just the script tag at the top that needs removing.

  7. David Platten

    Clicking on the How many studies column now sorts by the date of the most recent study in each row (as you asked for, Ed). I had trouble using the sorttable_customkey for this, so I've used a hidden div with the required date instead. Works fine. The only problem with this is that users will expect this column to be sorted by the number of studies, rather than by the date of the most recent study in each row. References issue #608

    → <<cset f59b6c994718>>

  8. David Platten

    Split number of studies and date of most recent study into their own cells. Added code so that the rows can be sorted by number of studies as well as date of most recent study. References issue #608

    → <<cset 244fb400bfce>>

  9. Ed McDonagh

    Thanks David. I should have had a div with the ID in displayname-modality.html, then put a <td> in it which would be replaced by the AJAX <td>. The replacement td could then have the sorttable_customkey with {{ latest|date:"Ymd" }} and it should work in the same way that your solution does.

    Problem is, it doesn't work as I had envisaged! I had hoped I could end up with a table that was sorted by display name and within that sorted by last study, so I can see how what has changed over time (normally software versions). But when I sort by display name after sorting by study date the study date order isn't preserved.

    So.... I think the best solution would be as follows: revert your study date sort so it just sorts by number of studies as expected, then instead sort the rows in the view so it starts in the way I want, and they can be resorted by column header from there.

    Um, what do you think? Feel a little guilty for wasting your time...

  10. Ed McDonagh

    Finally realised that my request is impossible without further revamping of how this page works, which is definitely not something to be done this side of a release, if ever! Of course the latest date isn't available until after the table is rendered!

    I am going to push this onto testing and create a PR - I think this should be merged in now.

    Thanks David

  11. Log in to comment