MultiSelect
The values of the control "MultiSelect" can be provided as static datasource (data formatted like a Json Array inside your template) or in case of a external datasource e.g. by referencing a HybridForms catalog by linking to the URL or by providing an oData source.
Static datasource:
<div
id="technician"
data-hf-control="MultiSelect"
data-hf-options="{
label: 'Technician',
required: true,
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_multiselect_liste"
data-hf-control="MultiSelect"
data-hf-options="{
label: 'MultiSelect (HFSql Catalogs)',
list: true,
minLength: 3,
url: '/api/catalogs/CatalogName?$select=Title,KatalogText,PLZ,Postort&%24orderby=Title,PLZ&%24top=1000',
template: HFFormdefinition.Namespace.setStreetTemplate,
dataTextField: 'KatalogText',
dataValueField: 'Title'
}"
></div>
Multilingual external datasource (URL):
<div
id="tab1_multiselect_liste"
data-hf-control="MultiSelect"
data-hf-options="{
label: 'MultiSelect (HFSql Catalogs)',
list: true,
minLength: 3,
template: HFFormdefinition.Namespace.setStreetTemplate,
url: '/api/catalogs/Items?$select=Title,KatalogText,Streetname,Strassenname&%24orderby=Title,PLZ&%24top=1000',
i18nDataTextField: {
en: 'Streetname',
de: 'Strassenname',
default: 'Streetname'
},
dataValueField: 'Title'
}"
></div>
External datasource (oData):
<div
id="liveOdataSource"
data-hf-control="MultiSelect"
data-hf-options="{
label: 'MultiSelect 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'stringcheckValueInitiallyβ
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; }[]highlightTemplateβ
highlight as default placeholder for the highlighted text.highlightTemplate: '<strong>#: highlight #</strong>'stringi18nDataTextFieldβ
{ en: 'Streetname', de: 'PLZ', 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 }onChangedβ
onChanged: HFFormdefinition.Namespace.Methodfunctionfunction(data: { value: string, text: string }) => voidpagingβ
paging: truebooleanpagingItemHeightβ
34.pagingItemHeight: 40numberpersistentβ
persistent: 'user''user'placeholderβ
placeholder: 'Please select ...'stringtooltipβ
tooltip: 'Please indicate at least one cause of damage.'stringtooltipTemplateβ
tooltipTemplate: 'example_control_tooltip'stringurlβ
url: '/_api/web/lists/getbytitle('SP')/Items?$select=Title&$orderby=Title'stringvalueMapperDelayβ
valueMapperDelay: truebooleanvisitingβ
visiting: truebooleanlistOptions Objectβ
dialogTextβ
dialogText: 'Display Text'stringPlease follow the conventions to build an OData Source Link by considering the following documentations:
copyValueFromβ
Define a FormControl that synchronizes its value with the current field. This synchronization process occurs upon navigating to the page where the current control is situated. It only occurs if the field is empty or the mode is set to "overwrite".
<div
id="tab1_multiselect_liste"
data-hf-control="MultiSelect"
data-hf-options="{
label: 'MultiSelect (HFSql Catalogs)',
list: true,
minLength: 3,
url: '/api/catalogs/CatalogName?$select=Title,KatalogText,PLZ,Postort&%24orderby=Title,PLZ&%24top=1000',
template: HFFormdefinition.Namespace.setStreetTemplate,
dataTextField: 'KatalogText',
dataValueField: 'Title',
copyValueFrom: 'tab1_multiselect_liste_2'
}"
></div>
interface ICopyValueFromObject {
sourceId: string;
mode: 'overwrite' | null;
callback: (value: string) => string;
}
type CopyValueFromType = string | ICopyValueFromObject;
callbackβ
callback: HFFormDefinition.Namespace.processValuefunctionfunction(value: string) => stringmodeβ
mode: 'overwrite'stringStored data
β<div
id="technician"
data-hf-control="MultiSelect"
data-hf-options="{
label: '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',
required: true
}"
></div>
For each MultiSelect inside your Forms there are two value pairs of stored data:
First the information for the MultiSelect itself...
{
"id": "technician",
"value": "3521|Lanner, G"
}
...and second for the selected value:
{
"id": "technician_HFText",
"value": "Simon, R|Lanner, G"
}