Control Definition XML File
The Control Definition XML file describes the Properties and behavior of the custom control and is used by the ControlUtil utility when registering the custom control in the K2 database.
We have provided two example XML files to describe the schema of this file.
File | Description |
---|---|
Control Type Definition XML file Basic | Sample of a Control Definition XML file with the basic structure and properties as described below |
Control Type Definition XML file Additional | Control definition file for a control with additional functionality such as methods, events, styling and more |
Basic Structure/Properties of the Control Definition XML File
The Custom Control definition XML file contains the following basic nodes:
<ControlType></ControlType>
Root node that contains all the control definition XML elements
<Category></Category>
This is the category of the control which determines how the rules wizard and other designers treat the control.
- Display: A control that has a static value/representation at runtime. (Display only, value cannot be changed with rules)
- Input: A control that has a dynamic value at runtime. (can be read/write and value can be set with rules)
- Listing: A control that has a value derived from an associated data source. Listing controls support being populated with one or more SmartObject records
- Action: A control usually without value that is used to perform an action by the user (example: Submit, Save, Navigate etc using Buttons, Links etc)
<Group></Group>
This is the name of the group that the control will be displayed in within the K2 Designer.
<Name></Name>
This is the short name for the control type stored in Form and View definitions
<DisplayName></DisplayName>
The is the display name shown in the controls tab and the name used when creating control instance names. Example: {displayname}, {displayname}1, {displayname}2, etc.
<FullName></FullName>
The full name of the control used to load and instantiate the control. Format: {TypeFullName},{AssemblyName} Note: TypeFullName refers to the fully qualified name.
<Properties></Properties>
Defines the various properties that the control may have. These are usually shown in the Properties tab when you design the form and select the control. Custom Controls require at least the Name property.
<Prop></Prop>
A property in the Properties collection. It supports the following attributes:
- ID: the unique name for the property
- setFunction: which function in the .js file should be called to set the value of the property
- friendlyName: the display name of the property in the design tool
- type: whether the property is a simple or complex type. Supported values are "simple", "drop" and "complex"
- category: specifies the property "group" that the property will be grouped under at design time
- refreshdisplay: whether the control should be refreshed when the property is changed. Supported values are "true" or "false"
- DesignerSet: the .js method called when the value is changed by the K2 designer
- DesignerValidate: the method used to validate the user's design-time input for the control. Mostly used to ensure unique Id for the control name
- inputlength: the maximum length of design-time input for the control