Skip to content

Commit dad2c61

Browse files
committed
#231 #217 - Fix for custom sort order in TaxonomyPicker
1 parent 0c010c8 commit dad2c61

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/services/SPTermStorePickerService.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ export default class SPTermStorePickerService {
159159
let terms = termStoreResultTerms[0]._Child_Items_;
160160
// Clean the term ID and specify the path depth
161161
terms = terms.map(term => {
162-
term.CustomSortOrderIndex = (termStoreResultTermSet.CustomSortOrder) ? termStoreResultTermSet.CustomSortOrder.split(":").indexOf(this.cleanGuid(term.Id)) : -1;
162+
if (term.IsRoot) {
163+
term.CustomSortOrderIndex = (termStoreResultTermSet.CustomSortOrder) ? termStoreResultTermSet.CustomSortOrder.split(":").indexOf(this.cleanGuid(term.Id)) : -1;
164+
} else {
165+
term.CustomSortOrderIndex = (term["Parent"].CustomSortOrder) ? term["Parent"].CustomSortOrder.split(":").indexOf(this.cleanGuid(term.Id)) : -1;
166+
}
163167
term.Id = this.cleanGuid(term.Id);
164168
term['PathDepth'] = term.PathOfTerm.split(';').length;
165169
term.TermSet = { Id: this.cleanGuid(termStoreResultTermSet.Id), Name: termStoreResultTermSet.Name };

0 commit comments

Comments
 (0)