Skip to content

Commit fbc88c3

Browse files
committed
addition to #765
1 parent e95fdb6 commit fbc88c3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/controls/taxonomyPicker/TaxonomyPicker.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
275275
// Add the checked term
276276
activeNodes.push(termItem);
277277

278-
// Filter out the duplicate terms
279-
activeNodes = uniqBy(activeNodes, 'key');
280278
} else {
281279
// Only store the current selected item
282280
activeNodes = [termItem];
@@ -292,6 +290,10 @@ export class TaxonomyPicker extends React.Component<ITaxonomyPickerProps, ITaxon
292290
};
293291
}));
294292
}
293+
294+
// Filter out the duplicate terms
295+
activeNodes = uniqBy(activeNodes, 'key');
296+
295297
} else {
296298
// Remove the term from the list of active nodes
297299
activeNodes = activeNodes.filter(item => item.key !== term.Id);

src/controls/taxonomyPicker/Term.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export default class Term extends React.Component<ITermProps, ITermState> {
4646
*/
4747
public componentWillReceiveProps?(nextProps: ITermProps, nextContext: any): void {
4848
// If multi-selection is turned off, only a single term can be selected
49-
if (!this.props.multiSelection) {
49+
//if (!this.props.multiSelection) {
5050
let active = nextProps.activeNodes.filter(item => item.key === this.props.term.Id);
51-
this.state = {
51+
this.setState ({
5252
selected: active.length > 0,
5353
termLabel: this.state.termLabel
54-
};
55-
}
54+
});
55+
//}
5656
}
5757

5858
/**

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
697697
<div className="ms-font-m">Services tester:
698698
<TaxonomyPicker
699699
allowMultipleSelections={true}
700+
selectChildrenIfParentSelected={true}
700701
//termsetNameOrID="61837936-29c5-46de-982c-d1adb6664b32" // id to termset that has a custom sort
701702
termsetNameOrID="8ea5ac06-fd7c-4269-8d0d-02f541df8eb9"
702703
initialValues={[{

0 commit comments

Comments
 (0)