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-hf-control="TreeView"
data-hf-options="{
label: 'TreeView',
url: '/api/catalog/Hierarchietest/hierarchy',
treeviewCtrlOptions: {
dataTextField: 'Text',
dataValueField: 'ID',
},
selectCtrlOptions:{
placeholder: 'Open tree',
}
}"
></div>
<div
id="treeview_complex"
data-hf-control="TreeView"
data-hf-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'
string
doNotCopy​
doNotCopy: true
boolean
list​
list: true
boolean
listOptions​
{ dialogText: string, dialogHide: boolean }
multiselect​
multiselect: true
boolean
onChanged​
onChanged: HFFormdefinition.Namespace.Method
function
function(value: { id: string, text: string }[]) => void
selectCtrlOptions: {placeholder: '...'}​
selectCtrlOptions: {placeholder: 'Open tree'}
MultiSelectOptions
textValueCallback​
textValueCallback: NameSpace.getTreeViewTextTemplate
function
function(nodeVal: string, node: any) => string
treeviewCtrlOptions​
treeviewCtrlOptions: { ... }
TreeViewOptions
treeviewCtrlOptions: {checkboxes: {..}}​
checkboxes: { checkChildren: true } }
TreeViewOptions
treeviewCtrlOptions: {dataTextField: 'Text'}​
dataTextField: 'Text'
TreeViewOptions
treeviewCtrlOptions: {dataValueField: 'ID'}​
dataValueField: 'ID'
TreeViewOptions
treeviewCtrlOptions: {selectOnlyLeaves: true}​
selectOnlyLeaves: true
TreeViewOptions
listOptions Object​
dialogText​
dialogText: 'Display Text'
string
Stored 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"
}