Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 305828

Summary: [Webapp] TOC should maintain selection when changing a filter
Product: [Eclipse Project] Platform Reporter: Martin Oberhuber <mober.at+eclipse>
Component: User AssistanceAssignee: Chris Goldthorpe <cgold>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: cgold, ChrisAustin, mober.at+eclipse, odandrad, susan, zhhaohh
Version: 3.6   
Target Milestone: 3.6 M7   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 76005, 223475    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Martin Oberhuber CLA 2010-03-15 06:12:57 EDT
+++ This bug was initially created as a clone of Bug #303105 +++

TOC filtering was added to the help webapp as per bug 223475. When a user is currently looking at some TOC entry and changes the filter, the entire TOC is rebuilt, thus losing the current selection and expand states.

This easily leads to a breakage of workflow. At least, the current TOC selection should be maintained if possible, when re-filtering. Since the webapp already has a "show in TOC" button / functionality to find the current displayed page in the TOC, I would hope that this should not be tremendously hard to implement.

Ideally, expand states should also be maintained when refiltering but that's less important than the selection.
Comment 1 Martin Oberhuber CLA 2010-03-15 06:23:26 EDT
Initial thoughts as per bug 303105 comment 10:

It's actually a non trivial piece of work because the DOM of the toc view
contains only the nodes that are shown based on the active filter or were once
shown and then collapsed. When you click on the expand button an Ajax call is
made to the server. For everything you can do in the toc view there is a
corresponding server side piece. 

Refiltering could cause any of the following to happen - new nodes to get
added, nodes to get removed, leaf nodes to become branch nodes, branches to
lose their leaves. One way to refilter would be to crawl the tree on the client
side and for each node starting from the top ask the server what children that
node has and whether each is a leaf or branch, fix up the children and keep
working down until all the branches had been handled. Another way would be to
have a list of nodes which were expanded before the filter operation and after
reopening the tree expand the same set of children. 

A poor man's solution which would be better than nothing would be to remember
the selected node and make sure that was selected after the rescope (if it was
in scope).

This poor man's solution would be good enough for me.
Comment 2 Chris Goldthorpe CLA 2010-03-18 17:42:11 EDT
Created attachment 162477 [details]
Patch
Comment 3 Chris Goldthorpe CLA 2010-03-18 18:54:30 EDT
Patch committed to HEAD, Fixed