DBTreeview
(part of package 'Servoy Extra Components') Extends designtime/SolutionModel: JSWebComponent Extends runtime: RuntimeWebComponent
A Servoy Extra Component that displays a database tree view.
This is a reference page; many components have detailed usage guides here.
Properties
allowDrag
Can be used to enable dragging of nodes. Can either be a boolean value or a clientfunction that is executed in browser. Default value is false. Type: Object
allowDrop
Can be used to enable dropping of nodes. Can either be a boolean value or a clientfunction that is executed in browser. Default value is false. Type: Object
autoRefresh
If true, component listens to foundset changes and updates itself while visible. Type: Boolean Default Value: true
enabled
Flag indicating whether the tree view is enabled for user interaction. Type: Boolean Default Value: true
responsiveHeight
Height of the treeview, set only in responsive forms. Type: Number Default Value: 0
showLoadingIndicator
Flag indicating whether a loading indicator is displayed while data is loading. Type: Boolean Default Value: true
styleClass
visible
Flag indicating whether the tree view is visible. Type: Boolean Default Value: true
Events
onDrop(sourceNodePkPath,targetNodePkPath,indexInParent,event)
Called when a node is dropped as a result of a drag-n-drop.
Parameters:
{Array<String>} sourceNodePkPath The primary key path of the source node.
{Array<String>} targetNodePkPath The primary key path of the target node.
{Number} indexInParent The index at which the node is dropped within its parent.
{JSEvent} event The event object associated with the drop action.
onReady(event)
Fired when the tree view is ready to be displayed.
Parameters:
{JSEvent} event The event object associated with the ready event.
API
addRoots(root)
Add foundset to the list of foundsets used to create the tree's root nodes.
Example:
Parameters:
createRelationInfo(label,nRelationName)
Create relation info object used to set multiple child relations for a tree node
Parameters:
Returns: CustomType<servoyextra-dbtreeview.relationInfo> An object containing the relation information for setting child relations in the tree structure.
getCheckBoxValues(datasource)
Returns array of pk of nodes that are checked for the datasource
Example:
Parameters:
{String} datasource The datasource identifier, representing the foundset for which the checked nodes' primary keys are retrieved.
Returns: Array<String> An array of primary keys of the nodes that are checked for the specified datasource.
getSelectionPath()
Returns the path of the currently selected node in the tree.
Example:
Returns: Array<Object> An array representing the path of the selected node in the tree.
isNodeExpanded(pk)
Returns expand state of a node.
Example:
Parameters:
{Array<Object>} pk Array of each level id
Returns: Boolean True if the specified node is expanded, false if it is collapsed.
refresh()
Refresh the tree display.
Example:
removeAllRoots()
Clears all foundset roots of the tree.
Example:
setActionsCallBack(actions)
Set callback info for specific actions.
Example:
Parameters:
{Array<CustomType<servoyextra-dbtreeview.action>>} actions An array of action objects, each defining a datasource, a callback function, its arguments, and the associated tree element for which the action should be triggered.
setCallBackInfo(datasource,callbackfunction,param)
Set callback info for a datasource foundset display.
Example:
Parameters:
setCheckBoxAutoselectsChildren(datasource,autoselect)
Set the nodes whose checkbox will automatically autoselect children.
Example:
Parameters:
setCheckBoxValueDataprovider(datasource,checkboxvaluedataprovider)
Set dataprovider for the checkbox displayed for a datasource foundset.
Example:
Parameters:
setChildSortDataprovider(datasource,childsortdataprovider)
Set the dataprovider name to retrieve column name and sort order for the child nodes. The provided data must be a string of form : column_name_used_for_sort sort_order(asc or desc)
Example:
Parameters:
setExpandNode(pk,state)
Sets expand state of a node.
Example:
Parameters:
{Array<Object>} pk Array of each level
{Boolean} state Expand state
setHasCheckBoxDataprovider(datasource,hascheckboxdataprovider)
Set relation for displaying a datasource foundset.
Example:
Parameters:
setHasCheckBoxValue(datasource,pks)
Set the nodes that should have checkbox for a datasource when no hascheckboxdataprovider is used
Example:
Parameters:
{String} datasource The datasource identifier, representing the foundset for which the checkboxes should be applied.
{Array<String>} pks Array of primary keys that should have a checkbox associated with them.
setImageURLDataprovider(datasource,imageurldataprovider)
Set dataprovider for the image displayed in tree node for a datasource foundset.
Example:
Parameters:
setInitialCheckBoxValues(datasource,pks)
Set intial checked checkboxes for a datasource foundset when no checkboxdataprovider is used
Example:
Parameters:
{String} datasource The datasource identifier, representing the foundset where checkboxes are applied.
{Array<String>} pks Array of pks that should have the checkbox checked
setMethodToCallOnCheckBoxChange(datasource,callbackfunction,param)
Set callback info for a datasource foundset checkbox display.
Example:
Parameters:
setMethodToCallOnDoubleClick(datasource,callbackfunction,param)
Set callback info for a datasource foundset doubleclick event.
Example:
Parameters:
setMethodToCallOnRightClick(datasource,callbackfunction,param)
Set callback info for a datasource foundset right click event.
Example:
Parameters:
setNRelationInfos(datasource,relationInfos)
Set n-relation infos (array of RelationInfo objects created using tree.createRelationInfo() for having multiple child relations for one node)
Parameters:
{String} datasource The datasource identifier, representing the foundset for which the relations are being set.
{Array<CustomType<servoyextra-dbtreeview.relationInfo>>} relationInfos An array of objects, defining multiple child relations for a single node.
setNRelationName(datasource,nrelationname)
Set relation for displaying a datasource foundset.
Example:
Parameters:
setNodeLevelVisible(level,visible)
Sets expanded state for a tree level. Expanding the tree may cause performance issues.
Example:
Parameters:
setSelectionPath(pk)
Sets selection node of the tree.
Example:
Parameters:
{Array<Object>} pk Array of each level id
setTextDataprovider(datasource,textdataprovider)
Set dataprovider for the text displayed from a datasource foundset.
Example:
Parameters:
setToolTipTextDataprovider(datasource,tooltiptextdataprovider)
Set dataprovider for the tooltip text displayed for a datasource foundset.
Example:
Parameters:
updateCheckBoxValues(datasource,pks,state)
Update checkbox state for nodes
Example:
Parameters:
{String} datasource The datasource identifier, representing the foundset for which the checkbox states are being updated.
{Array<String>} pks Array of primary keys of the nodes for which the checkbox state should be updated.
{Boolean} state True to check the checkbox, false to uncheck it.
Types
action
Represents an action configuration for tree view events. scripting type: CustomType<servoyextra-dbtreeview.action>
callbackfunction
The callback function to be executed for the action.
datasource
The datasource identifier related to the action.
Type: string
name
The unique name identifier for the action.
Type: string
param
The parameter to be passed to the callback function.
Type: string
binding
Represents binding configuration for tree view nodes. scripting type: CustomType<servoyextra-dbtreeview.binding>
callbackinfo
Callback information for tree view actions.
Type: callback
checkboxvaluedataprovider
The dataprovider for the checkbox value displayed in nodes.
Type: string
childsortdataprovider
The dataprovider that defines sorting for child nodes.
Type: string
datasource
The datasource identifier for the foundset.
Type: string
hasCheckboxValue
Represents the nodes that have an associated checkbox.
Type: object[]
hascheckboxdataprovider
The dataprovider for enabling checkboxes in nodes.
Type: string
imageurldataprovider
The dataprovider specifying the image URL for a node.
Type: string
initialCheckboxValues
Represents the initial checkbox values for nodes.
Type: object[]
methodToCallOnCheckBoxChange
Callback information for checkbox change events.
Type: callback
methodToCallOnDoubleClick
Callback information for double-click events on nodes.
Type: callback
methodToCallOnRightClick
Callback information for right-click events on nodes.
Type: callback
nRelationInfos
An array of relation information objects for defining multiple child relations.
Type: relationInfo[]
nrelationname
The relation name used for linking child nodes.
Type: string
textdataprovider
The dataprovider for the text displayed in a node.
Type: string
tooltiptextdataprovider
The dataprovider for the tooltip text displayed for nodes.
Type: string
callback
Represents callback information used in tree view operations. scripting type: CustomType<servoyextra-dbtreeview.callback>
f
The callback function to be executed.
param
The parameter to be passed to the callback function.
Type: string
levelVisibilityType
Represents the visibility settings for a tree level. scripting type: CustomType<servoyextra-dbtreeview.levelVisibilityType>
relationInfo
Represents relation information used for linking child nodes. scripting type: CustomType<servoyextra-dbtreeview.relationInfo>
Last updated
Was this helpful?