Taxonomy WebPart

The taxonomy webpart should be used when targeting the term store as a datasource.

Configuration

The edit form includes configurable dropdown lists, for selecting a target term group or set.

Examples

Refer to the custom solutions for examples of creating custom webparts.

JavaScript
var WebParts = require("gd-sprest-bs").WebParts;

// Create the webpart
WebParts.WPTaxonomy({
    elementId: "my-wpTaxonomy",
    cfgElementId: "my-wpTaxonomy-cfg",
    onRenderTermSetTerms: function(wpInfo, terms) {
        // Render the display element
        wpInfo.el.innerHTML = [
            '<h1>Term Set: ' + wpInfo.TermSetName + '</h1>',
            '<h5>Terms: ' + terms.length + '</h5>'
        ].join('\n');
    }
});
TypeScript
import { WebParts } from "gd-sprest-bs";

// Create the webpart
WebParts.WPTaxonomy({
    elementId: "my-wpTaxonomy",
    cfgElementId: "my-wpTaxonomy-cfg",
    onRenderTermSetTerms: (wpInfo, terms) => {
        // Render the display element
        wpInfo.el.innerHTML = [
            '<h1>Term Set: ' + wpInfo.TermSetName + '</h1>',
            '<h5>Terms: ' + terms.length + '</h5>'
        ].join('\n');
    }
});

Properties

Name Type Description
onRenderTermSet (wpInfo: IWPTaxonomyInfo, termSet: Types.Helper.ITerm) => void The on render term set event.
onRenderTermSets (wpInfo: IWPTaxonomyInfo, termSets: Array<Types.Helper.ITermSetInfo>) => void The on render term sets event.
onRenderTermSetTerms (wpInfo: IWPTaxonomyInfo, terms: Array<Types.Helper.ITermInfo>) => void The on render term set terms event.

Edit Form (IWPEditForm)

Name Type Description
onTermGroupChanged (wpInfo: IWPTaxonomyInfo, termGroupInfo?: ITermGroupInfo) => void The term group changed event.
onTermGroupsLoaded (wpInfo: IWPTaxonomyInfo, termGroups: Array<Components.IDropdownItem>) => Array<Components.IDropdownItem> The term group loaded event.
onTermSetChanged (wpInfo: IWPTaxonomyInfo, termSetInfo?: ITermInfo) => void The term set changed event.
onTermSetsLoaded (wpInfo: IWPTaxonomyInfo, termSets?: Array<Components.IDropdownItem>) => Array<Components.IDropdownItem> The term set loaded event.
onTermSetTermChanged (wpInfo: IWPTaxonomyInfo, termInfo?: ITermInfo) => void The term set term changed event.
onTermSetTermsLoaded (wpInfo: IWPTaxonomyInfo, terms?: Array<Components.IDropdownItem>) => Array<Components.IDropdownItem> The term set terms loaded event.
showTermSetTerms boolean Flag to display the term set terms.

WebPart Configuration (IWPCfg)

Name Type Description
TermGroupId string The term group id.
TermGroupName string The term group name.
TermSetId string The term set id.
TermSetName string The term set name.
TermSetTermId string The term set term id.
TermSetTermName string The term set term name.