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'
string
dataValueField - requiredβ
dataValueField: 'code'
string
checkValueInitiallyβ
checkValueInitially: true
boolean
true
dataSourceβ
dataSource: [{name: 'Bauer, F', code: 'Bauer, F'}, {name: 'Gruber, P', code: 'Gruber,P'}]
json pseudo array
defaultValueβ
defaultValue: 'Title1',
string | function
function() => string
disabledβ
disabled: true
boolean
doNotCopyβ
doNotCopy: true
boolean
filterItemsβ
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>'
string
i18nDataTextFieldβ
{ 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 | function
function(item: any) => string
listβ
list: true
boolean
listOptionsβ
{ dialogText: string, dialogHide: boolean }
onChangedβ
onChanged: HFFormdefinition.Namespace.Method
function
function(data: { value: string, text: string }) => void
persistentβ
persistent: 'user'
'user'
placeholderβ
placeholder: 'Please select ...'
string
tooltipβ
tooltip: 'Please indicate at least one cause of damage.'
string
tooltipTemplateβ
tooltipTemplate: 'example_control_tooltip'
string
urlβ
url: '/_api/web/lists/getbytitle('SP')/Items?$select=Title&$orderby=Title'
string
valueMapperDelayβ
valueMapperDelay: true
boolean
visitingβ
visiting: true
boolean
listOptions Objectβ
dialogTextβ
dialogText: 'Display Text'
string
Please 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.processValue
function
function(value: string) => string
modeβ
mode: 'overwrite'
string
Stored 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"
}