Skip to content
Snippets Groups Projects
Commit 3e4ade60 authored by esikkala's avatar esikkala
Browse files

Hierarchical facet: if a child has been previously selected, remove it

parent 2b1f75c3
No related branches found
No related tags found
No related merge requests found
...@@ -150,6 +150,15 @@ class HierarchicalFacet extends Component { ...@@ -150,6 +150,15 @@ class HierarchicalFacet extends Component {
recursiveSelect = (nodes, selected) => { recursiveSelect = (nodes, selected) => {
nodes.forEach(node => { nodes.forEach(node => {
// if a child has been previously selected, remove it
if (has(this.props.facet.uriFilter, node.id)) {
this.props.updateFacetOption({
facetClass: this.props.facetClass,
facetID: this.props.facetID,
option: this.props.facet.filterType,
value: { node }
});
}
node.selected = selected ? 'true' : 'false'; node.selected = selected ? 'true' : 'false';
node.disabled = selected ? 'true' : 'false'; node.disabled = selected ? 'true' : 'false';
if (has(node, 'children')) { if (has(node, 'children')) {
...@@ -159,7 +168,6 @@ class HierarchicalFacet extends Component { ...@@ -159,7 +168,6 @@ class HierarchicalFacet extends Component {
return nodes; return nodes;
}; };
handleCheckboxChange = treeObj => () => { handleCheckboxChange = treeObj => () => {
this.props.updateFacetOption({ this.props.updateFacetOption({
facetClass: this.props.facetClass, facetClass: this.props.facetClass,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment