Tables no longer sortable
E.g. on "display names & modality" page. Worked earlier but seems to be broken (0.8.0b1 release).
Comments (24)
-
-
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.
-
https://www.kryogenix.org/code/browser/sorttable/#ajaxtables
I'll see if I can fix this using the sorttable.js author's suggestion above.
-
Thanks @dplatten
-
Fixed table sorting for the display name list. References issue
#608→ <<cset da7e2fb87cc8>>
-
Putting back the link to the study deletion documentation that I removed in error. References issue
#608→ <<cset 141539a0784b>>
-
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!
-
sorttable.js is included in review_summary_list.html as well as displaynameview.html.
-
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.
-
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>>
-
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 thesortable
style.So I think it is just the script tag at the top that needs removing.
-
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>>
-
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>>
-
Thanks David. I should have had a
div
with the ID indisplayname-modality.html
, then put a<td>
in it which would be replaced by the AJAX<td>
. The replacementtd
could then have thesorttable_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...
-
Crossed posting...
-
Hmm. What do you think about my most recent commit?
-
I like the number of studies and the latest date columns being split. Good improvement.
-
BTW, I don't think that you can put <td> elements inside a <div> - you can only put <div>s within a <td>. See https://css-tricks.com/using-divs-inside-tables/. That's why I was finding the implementation of the custom key tricky.
-
Oh. That wouldn't work then.
-
Returning latest and count in one hit rather than two. Refs
#608→ <<cset ebd3a108c634>>
-
Removed the redundant view, renamed the one in use. Refs
#608. Unfortunately accidentally reformatted the urls.py→ <<cset ee2e4e1a9059>>
-
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
-
- changed status to resolved
-
Updating changes files. References issue
#608and issue#609→ <<cset 4ff975e6b707>>
- Log in to comment
My fault. I will have broken it when I moved the code to an AJAX loading.
If anyone fancies fixing it please do!