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
sf-model
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.
sf-taxonomy-id
Guid One way Contains the ID of the taxonomy.
sf-provider
String One way Contains the taxonomy provider.
sf-enable-auto-complete
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:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?