Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions src/controls/dynamicForm/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1287,11 +1287,13 @@ export class DynamicFormBase extends React.Component<
}
} else {
if (defaultValue !== "") {
const termId = defaultValue.split("|")[1];
selectedTags.push({
key: defaultValue.split("|")[1],
key: termId,
name: defaultValue.split("|")[0].split("#")[1],
});
value = selectedTags;
const term = await this._taxonomyService.getTermById(Guid.parse(field.TermSetId), Guid.parse(termId));
value = term;//selectedTags;
}
}
if (defaultValue === "") defaultValue = null;
Expand All @@ -1302,12 +1304,12 @@ export class DynamicFormBase extends React.Component<
anchorId = field.AnchorId !== Guid.empty.toString() ? field.AnchorId : null;
if (item && item[field.InternalName]) {
const _selectedTags = await this.getTermsForModernTaxonomyPicker(field.TermSetId,item[field.InternalName]);
item[field.InternalName].forEach((element) => {
selectedTags.push({
key: element.TermGuid,
name: element.Label,
});
});
// item[field.InternalName].forEach((element) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you comment this one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure anymore. It's been a while since the change. But I suspect it's because I wasn't sure what the purpose of the loop was at that point. It iterates over all the values ​​and pushes them into the "selectedTags" array. And then the array is no longer used. In my opinion, the lines can be deleted entirely, including line 1314. But that was already commented out in the code. Maybe that's why I didn't delete it.

// selectedTags.push({
// key: element.TermGuid,
// name: element.Label,
// });
// });

//value = selectedTags; _selectedTags
value = _selectedTags;
Expand All @@ -1321,7 +1323,12 @@ export class DynamicFormBase extends React.Component<
});
});

value = selectedTags;
const _selectedTags = await this.getTermsForModernTaxonomyPicker(field.TermSetId,selectedTags.map(dv => ({
Label: dv.name,
TermGuid: dv.key
})));
//value = selectedTags;
value = _selectedTags;
stringValue = selectedTags?.map(dv => dv.key + ';#' + dv.name).join(';#');
}
}
Expand Down