Skip to content

Commit

Permalink
addition to #765
Browse files Browse the repository at this point in the history
  • Loading branch information
AJIXuMuK committed Dec 29, 2020
1 parent e95fdb6 commit fbc88c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/controls/taxonomyPicker/TaxonomyPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
// Add the checked term
activeNodes.push(termItem);

// Filter out the duplicate terms
activeNodes = uniqBy(activeNodes, 'key');
} else {
// Only store the current selected item
activeNodes = [termItem];
Expand All @@ -292,6 +290,10 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
};
}));
}

// Filter out the duplicate terms
activeNodes = uniqBy(activeNodes, 'key');

} else {
// Remove the term from the list of active nodes
activeNodes = activeNodes.filter(item => item.key !== term.Id);
Expand Down
8 changes: 4 additions & 4 deletions src/controls/taxonomyPicker/Term.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export default class Term extends React.Component<ITermProps, ITermState> {
*/
public componentWillReceiveProps?(nextProps: ITermProps, nextContext: any): void {
// If multi-selection is turned off, only a single term can be selected
if (!this.props.multiSelection) {
//if (!this.props.multiSelection) {
let active = nextProps.activeNodes.filter(item => item.key === this.props.term.Id);
this.state = {
this.setState ({
selected: active.length > 0,
termLabel: this.state.termLabel
};
}
});
//}
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/webparts/controlsTest/components/ControlsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
<div className="ms-font-m">Services tester:
<TaxonomyPicker
allowMultipleSelections={true}
selectChildrenIfParentSelected={true}
//termsetNameOrID="61837936-29c5-46de-982c-d1adb6664b32" // id to termset that has a custom sort
termsetNameOrID="8ea5ac06-fd7c-4269-8d0d-02f541df8eb9"
initialValues={[{
Expand Down

0 comments on commit fbc88c3

Please sign in to comment.