Flat taxon field

The sfFlatTaxonField directive enables you to select and create taxa by typing their name in a text box. When you type a taxon's name, it is added next to other selected taxa. You can remove any selected taxa by clicking on their X button or by pressing Backspace on your keyboard. If you type a name of a taxon that does nt exist, it is automatically created in Sitefinity.

Flat taxon attributes

Attribute Type Binding Description
Array Two way To get the selected taxa, you can bind an array property to this attribute. Each element in the array contains the Id of the taxon.
Guid One way Contains the ID of the taxonomy.
String One way Contains the taxonomy provider.
Boolean One way If set to true, when you type in the text box, a dropdown menu with suggested taxa is displayed.

Add the flat taxon field directive

The following example demonstrates how to add a generic tree directive in a widget designer's view.

  1. Sitefinity CMS automatically registers the scripts you need and, if no other designer view with explicitly set priority exists, Sitefinity CMS sets your designer view priority 1. In case you need to have full control over the scripts that are loaded or you want to set custom priority, you can alternatively create your own DesignerView.YourView.json file. If you have a JSON file that matches the convention (even if empty), this automatic scripts registration will not occur. In the DesignerView.YourView.json file, add the path to the following files located in the scripts array:
  2. Sitefinity CMS automatically finds all AngularJS modules you rely on and references the widget designer to them. In case you rely on custom AngularJS modules or have logic that needs an AngularJS controller, you can create your own designerview-<yourview>.js file. If you have a .js file that matches the convention (even if empty), this automatic modules referencing will not occur. In your designerview-yourview.js file, right before the definition of your custom view controller, place the following code snippet:
  3. In your DesignerView.YourView.cshtml file, place the following tag where you want to render the sfFlatTaxonField directive:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.


Was this article helpful?