Opened 18 years ago
Closed 16 years ago
#5301 closed defect (fixed)
Expand dir: sorting column resets the expanded tree
Reported by: | Emmanuel Blot | Owned by: | Christian Boos |
---|---|---|---|
Priority: | low | Milestone: | 0.12 |
Component: | version control/browser | Version: | devel |
Severity: | minor | Keywords: | helpwanted |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When a directory tree has been expanded, and the user select a column header to modify the sorting (for example, sort-by-age), the expanded tree is folded entirely.
Attachments (0)
Change History (4)
comment:1 by , 18 years ago
Milestone: | → 2.0 |
---|
comment:2 by , 18 years ago
Keywords: | helpwanted added |
---|
Just had an afterthought, here's an implementation idea:
- modify the sort links so that they call a "sortDir" method instead
- maintain a tree of all the fetched folders in the expand/close callbacks
In "sortDir(order)"
- prune the tree of fetched folders so that it contains only the opened folders
- remove all the rows
- fetch again all the folders, in top-down order
That solution admittedly puts some load on the server, but is simpler to implement than a smart in place sort that would essentially duplicate the sort logic in browser.py (with the additional complexity of having to reparse dates and sizes (0.8kB > 345 bytes!) and deal with the "logical" tree of folders…
comment:3 by , 16 years ago
Milestone: | 2.0 → 0.12 |
---|
Actually a simpler solution would be to modify the sorting links, so that they contain the last expanded folder path.
Required change on top of #7074:
-
trac/htdocs/js/expand_dir.js
diff -r bf27bb706173 trac/htdocs/js/expand_dir.js
a b 79 79 .substr(window.location.pathname.length+1) 80 80 .replace(/([^?]*)(\?.*)?$/, '$1'); 81 81 82 // update sort links in column headers 83 tr.parents("table:first").find("thead tr:first").find("a").each(function(){ 84 var href = $(this).attr("href").replace(/#.*$/, ''); 85 $(this).attr("href", href+window.location.hash); 86 }); 87 82 88 if ( tr.hasClass("collapsed") ) { // then *expand* 83 89 tr.removeClass("collapsed").addClass("expanded"); 84 90 tr.siblings("tr."+folderid).show();
Yes, I know, but at this point, I have no intent to change this. This would be overly complex for no real benefit, as once you've changed the sorting order, it remains in use and will be used for all the expanded entries.
If someone wants to implement this however, patches are welcomed ;-)