Skip to main content

Combo properties

Usage

{
type: "combo",
name?: string,
id?: string,
data?: object[],
value?: string | number | array,

css?: string,
disabled?: boolean,
height?: string | number | "content", // "content" by default
hidden?: boolean,
padding?: string | number,
required?: boolean, // false by default
validation?: (id: (string | number) | (string | number)[], text: string | string[]) => boolean,
width?: string | number | "content", // "content" by default

filter?: (item: any, input: string) => boolean,
itemHeight?: number | string, // 32 by default
itemsCount?: boolean | ((count: number) => string),
listHeight?: number | string, // 224 by default
multiselection?: boolean, // false by default
newOptions?: boolean,
placeholder?: string,
readOnly?: boolean, // false by default
selectAllButton?: boolean, // false by default
template?: (item: any) => string,
virtual?: boolean, // false by default

hiddenLabel?: boolean, // false by default
label?: string,
labelPosition?: "left" | "top", // "top" by default
labelWidth?: string | number,

helpMessage?: string,
preMessage?: string,
successMessage?: string,
errorMessage?: string,
}

Description

type(required) the type of a control, set it to "combo"
name(optional) the name of a control
id(optional) the id of a control, auto-generated if not set
data(optional) an array of Combo options. Each option is an object with a set of key:value pairs - attributes of options and their values.
  • The id attribute is returned and goes to form data. This attribute should always be fulfilled to avoid unexpected behavior
  • The value attribute is displayed in the input field
value(optional) specifies the id(s) of Combo options from data collection which values should appear in the input:
  • if multiselection:true is set for a combo, the property can be set as an array of string/number values
    (for example, value: ["id_1","id_2","id_3"], or value: [1, 2, 3])
  • if multiselection:false is set or the multiselection config is not defined, the property can be set as a string/number, or an array
    (for example, value:"id_1", value: 1, or value: ["id_1"])
css(optional) adds style classes to a control
disabled(optional) defines whether a control is enabled (false) or disabled (true)
height(optional) the height of a control
hidden(optional) defines whether a control is hidden
padding(optional) sets padding between a cell and a border of the Combo control
required(optional) defines whether the field with Combo is required (for a form)
validation(optional) a callback function which allows to validate Combo options.
The function takes two parameters:
  • id - (required) the ID(s) of the option(s) to validate
  • text - (required) the value(s) of the option(s)
and returns true/false to indicate the result of validation
width(optional) the width of a control
filter(optional) sets a custom function for filtering Combo options. Check the details.
itemHeight(optional) sets the height of a cell in the list of options
itemsCount(optional) shows the total number of selected options
listHeight(optional) sets the height of the list of options
multiselection(optional) enables selection of multiple options in Combo
newOptions(optional) allows end users to add new values into the list of combobox options. To add a new value, the user needs to type it into the input field and either press "Enter" or click on the appeared Create "newValue" option in the drop-down list.
placeholder(optional) sets a placeholder in the input of Combo
readOnly(optional) makes Combo readonly (it is only possible to select options from the list, without entering words in the input)
selectAllButton(optional) defines whether the Select All button should be shown
template(optional) sets a template of displaying options in the popup list
virtual(optional) enables dynamic loading of data on scrolling the list of options
hiddenLabel(optional) invisible label that will be used to identify the input on the server side
label(optional) specifies a label for a control
labelPosition(optional) defines the position of a label: "left"|"top"
labelWidth(optional) sets the width of the label of a control
helpMessage(optional) adds a help message to a control
preMessage(optional) a message that contains instructions for interacting with the control
successMessage(optional) a message that appears in case of successful validation of the control value
errorMessage(optional) a message that appears in case of error during validation of the control value

Example

Related article: Combo