We have found a possible bug in hierarchical facets.
Take the following example: 
http://people.csail.mit.edu/dfhuynh/projects/hierarchical-facets/test.html
1. Within the "subject" facet, expand the node "nature" by clicking on
the corresponding arrow
2. Select one of its children, e.g. "seascapes and coast", to apply
the filter.
3. Now collapse the node "nature" by clicking again on the arrow. What
happens: the filter "seascapes and coast" remains selected (and in
fact results are still filtered), but now the user has no visual
feedback on that selection.

We have tried to solve this usability problem by modifing the code in
http://static.simile.mit.edu/exhibit/api-2.0/scripts/ui/facets/hierarchical-facet.js
in order to prevent collapsing the parent node if one of its children
(or children of its children) is selected.
The modified code is available here:
http://www.ellesseweb.com/archeo-search/exhibit/scripts/ui/facets/hierarchical-facet.js.
A recursive function has been introduced to test if a node has any
children selected:

 var onToggleChildren = function(elmt, evt, target) {
            var show;
            if ((node.value in self._expanded)) {
                                if (!hasChildrenSelected(node.children)) {
                                        delete self._expanded[node.value];
                                        show = false;
                                } else {
                                        show = true;
                                }
...
var hasChildrenSelected = function(myChildNodes) {
                for (var i=0; i < myChildNodes.length; i++) {
                        if (myChildNodes[i].selected ||
                                (myChildNodes[i].value in self._expanded &&     
hasChildrenSelected
(myChildNodes[i].children)))
                        return true;
                }
                return false;
    };

The recursivity is necessary to take into account more than two levels
of hierarchy.

It is a quick workaround but works: when the user tries to collapse a
node whose children have been previously selected, nothing happens. If
the children is deselected, the parent node is collapsible again.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to