Edgewall Software

Opened 12 years ago

Closed 10 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:


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 Christian Boos, 12 years ago

Milestone: 2.0

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 ;-)

comment:2 by Christian Boos, 12 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 Christian Boos, 11 years ago

Milestone: 2.00.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  
    7979        .substr(window.location.pathname.length+1)
    8080        .replace(/([^?]*)(\?.*)?$/, '$1');
     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     });
    8288    if ( tr.hasClass("collapsed") ) { // then *expand*
    8389      tr.removeClass("collapsed").addClass("expanded");
    8490      tr.siblings("tr."+folderid).show();

comment:4 by Christian Boos, 10 years ago

Resolution: fixed
Status: newclosed

Was fixed in r7981.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Christian Boos.
The resolution will be deleted.
to The owner will be changed from Christian Boos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.