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-win-control="HFWinJSCtrl.DropDownList"
data-win-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-win-control="HFWinJSCtrl.DropDownList"
data-win-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-win-control="HFWinJSCtrl.DropDownList"
data-win-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-win-control="HFWinJSCtrl.DropDownList"
data-win-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: truebooleanformControlMappingβ
{ example_id: 'example_key' }IFormControlMappingi18nDataTextFieldβ
{ en: 'Streetname', de: 'Strassenname', default: βStreetname' }{ default: string, [langCode: string]: string }listβ
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'stringpersistentβ
persistent: 'user''user'templateβ
template: '#: Streetname # (#: PLZ # #: Postort #)',string | functionfunction() => stringtooltipβ
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.
Every value change the specified data source entries are copied to the given form controls.
<div id="exmaple_mapping"
data-win-control="HFWinJSCtrl.DropDownList"
data-win-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-win-control="HFWinJSCtrl.DropDownList"
data-win-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"
}