DropDownList
The new control is an alternative to the Control "ComboBox". The values of the control "DropDownList" can be provided as static datasource (data formatted as JSON Array inside your Template) or by an external datasource e.g. by referencing a HFSqlServer list by linking to the URL or by providing an oData source as known of the ComboBox control.
static datasource:
<div
id="technician"
data-hf-control="DropDownList"
data-hf-options="{
label: 'Technician',
required: true,
optionLabel: 'Please select the responsible technician',
dataSource: [
{ name: 'Bauer, F', code: 'Bauer, F' },
{ name: 'Gruber, P', code: 'Gruber, P' },
{ name: 'Lanner, G', code: 'Lanner, G' },
{ name: 'Simon, R', code: '3521' },
{ name: 'Herbert, W', code: '123456789012' }
],
dataTextField: 'name',
dataValueField: 'code'
}"
></div>
external datasource (URL):
<div
id="tab1_dropdownlist"
data-hf-control="DropDownList"
data-hf-options="{
label: 'DropDownList (HFSql Catalogs)',
list: true,
minLength: 3,
url: '/api/catalogs/Items?$select=Title,KatalogText,Streetname&%24orderby=Title,PLZ&%24top=1000',
defaultValue: 'Title1',
dataTextField: 'KatalogText',
dataValueField: 'Title',
template: '\#: Streetname # <small>(#: PLZ # #: Postort #)</small>',
valueTemplate: '\<strong>#: Streetname #</strong> <small>(#: PLZ # #: Postort #)</small>',
}"
></div>
multilingual external datasource (URL):
<div
id="tab1_dropdownlist"
data-hf-control="DropDownList"
data-hf-options="{
label: 'DropDownList (HFSql Catalogs)',
list: true,
minLength: 3,
url: '/api/catalogs/Items?$select=Title,KatalogText,Streetname,Strassenname&%24orderby=Title,PLZ&%24top=1000',
i18nDataTextField: {
en: 'Streetname',
de: 'Strassenname',
default: 'Streetname'
},
dataValueField: 'Title',
template: '\#: Streetname # <small>(#: PLZ # #: Postort #)</small>',
valueTemplate: '\<strong>#: Streetname #</strong> <small>(#: PLZ # #: Postort #)</small>',
}"
></div>
external datasource (OData):
<div
id="liveOdataSource"
data-hf-control="DropDownList"
data-hf-options="{
label: 'DropDownList with live OData source',
required: true,
dataTextField: 'KatalogText',
dataValueField: 'Title',
autoBind: false,
dataSource: {
type: 'odata',
transport: {
read: {
url:'https://example.com/liveOdataSource/?select=Title,KatalogText&orderby=KatalogText',
dataType: 'json',
headers: {
'Accept': 'application/json;odata=verbose'
}
}
}
}
}"
></div>
FormControl Options
Options of the kendo component are also available. read more
dataTextField - required
dataTextField: 'name'stringdataValueField - required
dataValueField: 'code'stringautoBind
autoBind: falsebooleantruecheckValueInitially
checkValueInitially: truebooleantruedataSource
dataSource: [{name: 'Bauer, F', code: 'Bauer, F'}, {name: 'Gruber, P', code: 'Gruber,P'}]json pseudo arraydefaultValue
defaultValue: 'Title1',string | functionfunction() => stringdisabled
disabled: truebooleandoNotCopy
doNotCopy: truebooleanfilterItems
contains. More infos[{ field: 'name', operator: 'contains' }, { field: 'address' }]{ field: string; operator?: string; }[]formControlMapping
{ example_id: 'example_key' }IFormControlMappinghighlightTemplate
highlight as default placeholder for the highlighted text.highlightTemplate: '<strong>#: highlight #</strong>'stringi18nDataTextField
{ en: 'Streetname', de: 'Strassenname', default: ‘Streetname' }{ default: string, [langCode: string]: string }itemTemplate
template option, itemTemplate keeps the original filter highlighting.itemTemplate: '<span>#: entry1 # - #: entry2 #</span>'string | functionfunction(item: any) => stringlist
list: truebooleanlistOptions
{ dialogText: string, dialogHide: boolean }minLength
minLength: 3numberonChanged
onChanged: HFFormdefinition.Namespace.Methodfunctionfunction(data: { value: string, text: string }) => voidoptionLabel
optionLabel: 'Please select ...'stringoptionTemplate
optionTemplate: 'label'stringpaging
paging: truebooleanpagingItemHeight
34.pagingItemHeight: 40numberpersistent
persistent: 'user''user'tooltip
tooltip: 'Please indicate at least one cause of damage.'stringtooltipTemplate
tooltipTemplate: 'example_control_tooltip'stringtypeAhead
typeAhead: false,booleantrueurl
url: '/api/catalogs/Items?$select=Title,KatalogText&$orderby=Title'stringvalueMapperDelay
valueMapperDelay: truebooleanvalueTemplate
valueTemplate: '#: Streetname # (#: PLZ # #: Postort #)'stringvisiting
visiting: truebooleanlistOptions Object
dialogText
dialogText: 'Display Text'stringPlease follow the conventions to build an oData Source Link by considering the following documentations:
formControlMapping
The mapping objects consists of keys which are the Form control ID's to copy to and the value which can be a data source key or an object with the data source key and a format function.
By every value change the specified data source entries are copied to the given Form controls.
<div
id="exmaple_mapping"
data-hf-control="DropDownList"
data-hf-options="{
label: 'Example',
url: '/api/catalogs/Example?$select=Text,Value,Description,Date',
dataTextField: 'Text',
dataValueField: 'Value',
formControlMapping: {
description: 'Description',
date_picker: {
key: 'Date',
callback: HFFormdefinition.ExampleNamespace.formatDateFunc
}
}
}"
></div>
type FormControlMappingType = {
key: string;
callback: (dataItem: any, dataKey: string) => any;
};
interface IFormControlMapping {
[id: string]: string | FormControlMappingType;
}
Stored data
<div
id="technician"
data-hf-control="DropDownList"
data-hf-options="{
label: 'Technician',
dataSource: [
{ name: 'Bauer, F', code: '1' },
{ name: 'Gruber, P', code: '2' },
{ name: 'Lanner, G', code: '3' },
{ name: 'Simon, R', code: '4' },
{ name: 'Herbert, W', code: '5' }
],
dataTextField: 'name',
dataValueField: 'code',
required: true
}"
></div>
For each DropDownList inside your Forms there are two value pairs of stored data:
First the information for the DropDownList itself...
{
"id": "technician",
"value": "3521"
}
...and second for the selected value:
{
"id": "technician_HFDropDownListText",
"value": "Simon, R"
}