TreeView
The TreeView control enables you to display complex dataSources/catalogs in a hierarchical view and offers the possibility to select and store multiple values as well as the hierarchical path of the values.
The catalogs must be valid and compatible JSON represenations.
If you develop locally in the FormDev environment itΒ΄s best to paste the full catalog URL including the "hierarchy" part (eg. https://exampleserver.hybridforms.net/api/catalog/TreeviewCatalog/hierarchy) in your browser and add the resulting JSON response as local file to your formDefinition folder.
<div id="treeview_minimum"
data-win-control="HFWinJSCtrl.TreeView"
data-win-options="{
label: 'TreeView',
url: '/api/catalog/Hierarchietest/hierarchy',
treeviewCtrlOptions: {
dataTextField: 'Text',
dataValueField: 'ID',
},
selectCtrlOptions:{
placeholder: 'Open tree',
}
}"></div>
<div id="treeview_complex"
data-win-control="HFWinJSCtrl.TreeView"
data-win-options="{
label: 'TreeView',
multiselect: true,
url: '/api/catalog/Hierarchietest/hierarchy?start=0001&maxlevel=3&sort=Text&select=Text,ID',
treeviewCtrlOptions: {
checkboxes: {
checkChildren: true
},
dataTextField: 'Text',
dataValueField: 'ID',
selectOnlyLeaves: true,
},
textValueCallback: HFFormdefinition.QAFormHelpers.getTreeViewTextTemplate,
selectCtrlOptions:{
placeholder: 'Open tree',
},
onChanged: HFFormdefinition.QAFormHelpers.onTreeViewChange
}"></div>
The TreeView control currently supports only a via URL provided datasource.
FormControl Optionsβ
Options of the kendo components are also available. (TreeView, MultiSelect) read more
url - requiredβ
- start: Define the start node inside the catalog to reduce the provided items.
- maxlevel: Define the nodes depth (levels) of the presented catalog to reduce the provided items for example show only items of the first three levels.
- sort: Define a sort criterion according to which the items are sorted in ascending order. These sort values are used to build up the "sortpath".
- select: Define the columns to be included in the query. Not defined the complete catalogs is queried.
url: '/api/catalog/Hierarchietest/hierarchy?start=0001'stringdoNotCopyβ
doNotCopy: truebooleanlistβ
list: truebooleanlistOptionsβ
{ dialogText: string, dialogHide: boolean }multiselectβ
multiselect: truebooleanonChangedβ
onChanged: HFFormdefinition.Namespace.Methodfunctionfunction(value: { id: string, text: string }[]) => voidselectCtrlOptions: {placeholder: '...'}β
selectCtrlOptions: {placeholder: 'Open tree'}MultiSelectOptionstextValueCallbackβ
textValueCallback: NameSpace.getTreeViewTextTemplatefunctionfunction(nodeVal: string, node: any) => stringtreeviewCtrlOptionsβ
treeviewCtrlOptions: { ... }TreeViewOptionstreeviewCtrlOptions: {checkboxes: {..}}β
checkboxes: { checkChildren: true } }TreeViewOptionstreeviewCtrlOptions: {dataTextField: 'Text'}β
dataTextField: 'Text'TreeViewOptionstreeviewCtrlOptions: {dataValueField: 'ID'}β
dataValueField: 'ID'TreeViewOptionstreeviewCtrlOptions: {selectOnlyLeaves: true}β
selectOnlyLeaves: trueTreeViewOptionslistOptions Objectβ
dialogTextβ
dialogText: 'Display Text'stringStored dataβ
For each TreeView inside your forms there are two value pairs of stored data:
First the information for the TreeView itself
{
"id": "treeview",
"value": "0009"
}
and second for the selected value:
{
"id": "treeview_HFText",
"value": "Punkt 3"
}