Taxonomy Picker - initialValues should only require key and/or name
See original GitHub issueCategory
[x] Enhancement [ ] Bug [ ] Question
Version
[3.2.1]
Expected / Desired Behaviour / Question
When setting the default value (via initialValues
) for the Taxonomy Picker, I should only need to provide the key and/or the name of the metadata properties to select.
Observed Behaviour
Taxonomy Picker initialValues
requires an object of IPickerTerms which requires key, name, path and termset. Path cannot be retrieved from the API and termset is redundant as it would always be the same as the value provided to termsetNameOrID
property of the control. As a workaround, I’m assigning a new object of type IPickerTerms with the correct key and name and empty string values “” for path and termset and I’m able to load the values correctly as well as save them using terms provided in onChange.
Steps to Reproduce
Follow the How to use sample and extend it to add a static initialValues
as below (this should work, assuming you have these terms in your term store)
{[
{
key: "ee4bb03d-6046-4195-bd9f-f098fa990797",
name: "Term1",
path: "Parent1;Term1",
termSet:"949a3a28-94db-447f-be03-13fada209e69"
}
]}
I should only need to provide key and/or name - path and termSet should not be required
Happy to look into a PR to address this if this is agreed to be useful.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@M365Bass Thanks for the feedback, it’s something that I have also experienced myself so completely understand the scenario. It’s handy to have the same interface as the change event as you may need to, for example, select items that were previously selected; but clearly has unnecessary properties when defining manually. I will update the documentation to include a note stating that path and termset can be empty values.
@M365Bass documentation was updated previously and I have improved it slightly. As mentioned before, it is useful to maintain the same interface for objects, so the recommendation is to pass empty values for the properties that are not used if you don’t have their values at a given point. Many thanks for raising it, I will now close this issue