@@ -185,42 +185,43 @@ You can also use the `TaxonomyTree` control separately to just render a stand-al
185
185
Initialize the taxonomy service and state, load basic info from term store and display the ` TaxonomyTree ` component.
186
186
187
187
``` TypeScript
188
- const taxonomyService = new SPTaxonomyService (props .context );
189
- const [terms, setTerms] = React .useState <ITermInfo []>([]);
190
- const [currentTermStoreInfo, setCurrentTermStoreInfo] = React .useState <ITermStoreInfo >();
191
- const [currentTermSetInfo, setCurrentTermSetInfo] = React .useState <ITermSetInfo >();
192
- const [currentLanguageTag, setCurrentLanguageTag] = React .useState <string >(" " );
193
-
194
- React .useEffect (() => {
195
- sp .setup (props .context );
196
- taxonomyService .getTermStoreInfo ()
197
- .then ((termStoreInfo ) => {
198
- setCurrentTermStoreInfo (termStoreInfo );
199
- setCurrentLanguageTag (props .context .pageContext .cultureInfo .currentUICultureName !== ' ' ?
200
- props .context .pageContext .cultureInfo .currentUICultureName :
201
- currentTermStoreInfo .defaultLanguageTag );
202
- });
203
- taxonomyService .getTermSetInfo (Guid .parse (props .termSetId ))
204
- .then ((termSetInfo ) => {
205
- setCurrentTermSetInfo (termSetInfo );
206
- });
207
- }, []);
208
-
209
- return (
210
- {currentTermStoreInfo && currentTermSetInfo && currentLanguageTag && (
211
- <TaxonomyTree
212
- languageTag = {currentLanguageTag }
213
- onLoadMoreData = {taxonomyService.getTerms }
214
- pageSize = {50 }
215
- setTerms = {setTerms }
216
- termSetInfo = {currentTermSetInfo }
217
- termStoreInfo = {currentTermStoreInfo }
218
- terms = {terms }
219
- onRenderActionButton = {onRenderActionButton }
220
- hideDeprecatedTerms = {false }
221
- showIcons = {true }
222
- />
223
- )}
188
+ const taxonomyService = new SPTaxonomyService (props .context );
189
+ const [terms, setTerms] = React .useState <ITermInfo []>([]);
190
+ const [currentTermStoreInfo, setCurrentTermStoreInfo] = React .useState <ITermStoreInfo >();
191
+ const [currentTermSetInfo, setCurrentTermSetInfo] = React .useState <ITermSetInfo >();
192
+ const [currentLanguageTag, setCurrentLanguageTag] = React .useState <string >(" " );
193
+
194
+ React .useEffect (() => {
195
+ sp .setup (props .context );
196
+ taxonomyService .getTermStoreInfo ()
197
+ .then ((termStoreInfo ) => {
198
+ setCurrentTermStoreInfo (termStoreInfo );
199
+ setCurrentLanguageTag (props .context .pageContext .cultureInfo .currentUICultureName !== ' ' ?
200
+ props .context .pageContext .cultureInfo .currentUICultureName :
201
+ currentTermStoreInfo .defaultLanguageTag );
202
+ });
203
+ taxonomyService .getTermSetInfo (Guid .parse (props .termSetId ))
204
+ .then ((termSetInfo ) => {
205
+ setCurrentTermSetInfo (termSetInfo );
206
+ });
207
+ }, []);
208
+
209
+ return (
210
+ {currentTermStoreInfo && currentTermSetInfo && currentLanguageTag && (
211
+ <TaxonomyTree
212
+ languageTag = {currentLanguageTag }
213
+ onLoadMoreData = {taxonomyService.getTerms }
214
+ pageSize = {50 }
215
+ setTerms = {setTerms }
216
+ termSetInfo = {currentTermSetInfo }
217
+ termStoreInfo = {currentTermStoreInfo }
218
+ terms = {terms }
219
+ onRenderActionButton = {onRenderActionButton }
220
+ hideDeprecatedTerms = {false }
221
+ showIcons = {true }
222
+ />
223
+ )}
224
+ );
224
225
```
225
226
226
227
![ ] ( https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ModernTaxonomyPicker )
0 commit comments