ui.tree

A hierarchical structure of nodes..

Each node in the tree might contain any number of nodes. Nodes that contain child nodes can be expanded or collapsed.

The component supports in-line node editing, advanced drag-and-drop, three-state checkboxes, etc. Check tree documentation for more detailed description.

Constructor

var tree = webix.ui({
    view:"tree",
    select:true,
    data: [
        {id:"root", value:"Cars", open:true, data:[
            { id:"1", open:true, value:"Toyota", data:[
                { id:"1.1", value:"Avalon" },
                { id:"1.2", value:"Corolla" },
                { id:"1.3", value:"Camry" }
            ]},
            { id:"2", value:"Skoda", open:true, data:[
                { id:"2.1", value:"Octavia" },
                { id:"2.2", value:"Superb" }
            ]}
        ]}
    ]
});

Where to start

Methods
add adds an item to the store
addCss applied CSS class to a component item
adjust adjusts the component to the size of the parent HTML container
attachEvent attaches the handler to an inner event of the component (allows behavior customizations)
bind binds components
blockEvent temporarily blocks triggering of ALL events of the calling object
callEvent calls an inner event
checkAll check all items in tree
checkItem checks the checkbox it the tree item
clearAll removes all items from the component
clearCss removes CSS class from all items
clearValidation removes all validation marks from the component
close closes the branch with the specified id
closeAll closes all branches in the tree
copy makes a copy of an item
count returns the number of currently visible items
customize redefines the "type" property
define redefines a single configuration property (or a hash of properties)
destructor destructs the calling object
detachEvent detaches a handler from an event (which was attached before by the attachEvent method)
disable disables the calling view (makes it dimmed and unclickable)
enable enables the calling view that was disabled by the 'disable' method
exists checks whether an item with the specified id exists
filter filters the component
find returns rows that match the criterion
getBranchIndex gets index of the node in a specific branch
getChecked returns ids of the checked items
getChildViews returns child views of the calling component
getFirstChildId gets the ID of the first child of the specified branch
getFirstId returns the ID of the first item
getFormView returns master form for the input
getIdByIndex returns the id of the item with the specified index
getIndexById returns the index of the item with the specified id
getItem gets the object of the data item with the specified id
getItemNode returns HTML element of the item
getLastId returns the id of the last item
getNextId returns the ID of an item which is positioned the specified step after the specified item
getNextSiblingId returns the id of the next sibling of the specified node
getNode returns the main HTML container for the calling object
getOpenItems returns ids of the opened branches
getParentId get the ID of the parent node of the specified item
getParentView returns the parent view of the component
getPrevId returns the ID of an item which is positioned the specified step before the specified item
getPrevSiblingId returns the id of the previous sibling of the specified node
getScrollState returns the scroll position
getSelectedId returns the id(s) of the selected item(s)
getSelectedItem returns selected object
getState returns the current state of the view
getTopParentView returns top parent view
group groups data by the specified data property
hasCss checks if item has specific css class
hasEvent checks whether the component has the specified event
hide hides the view
isBranch checks whether the node has any children
isBranchOpen checks whether the specified branch is open or closed
isChecked checks whether the specified node is checked
isEnabled checks whether the view is enabled
isSelected checks whether the specified item is selected or not
isVisible checks whether the view is visible
load loads data from an external data source.
loadBranch loads data to the specified branch, as direct children of the node with the id provided
loadNext sends a request to load the specified number of records to the end of the client-side dataset or to the specified position
locate gets the id of an item from the specified HTML event
mapEvent routes events from one object to another
move moves the specified item to the new position
moveSelection moves selection in the specified direction
open opens the branch with the specified id
openAll opens all branches in the tree
parse loads data to the component from an inline data source
queryView returns inner element/elements of a widget that correspond to the defined parameters
refresh repaints the whole view or a certain item
remove removes the specified item/items from datastore
removeCss removes CSS class from a component item
render renders the specified item or the whole component
resize adjusts the view to a new size
scrollTo scrolls the data container to a certain position
select selects the specified item(s)
selectAll selects all items or the specified range
serialize serializes data to a JSON object
setState restores the specified state
show makes the component visible
showItem scrolls the component to make the specified item visible
sort sorts datastore
sync allows syncing two copies of data (all or just a part of it) from one DataCollection to another
unbind breaks "bind" link
unblockEvent cancels blocking events that was enabled by the 'blockEvent' command
uncheckAll uncheck all items in the tree
uncheckItem unchecks the checkbox in the tree item
ungroup ungroups data
unselect removes selection from the specified item
unselectAll removes selection from all items
updateItem updates the data item with new properties
validate validates one record or all dataset against the validation rules
Events
onAfterAdd fires after adding item to datastore
onAfterClose fires after the branch has been closed
onAfterContextMenu fires after the context menu was called in the item area
onAfterDelete fires after item deleting
onAfterDrop fires after drag-n-drop was finished
onAfterDropOrder called when dnd reordering is fully finished
onAfterLoad fires after data loading is complete
onAfterOpen fires after the branch has been opened
onAfterRender occurs immediately after the component has been rendered
onAfterScroll occurs when some webix view has been scrolled
onAfterSelect fires after item was selected
onAfterSort fires after sorting dataset
onBeforeAdd fires before adding item to datastore
onBeforeClose fires the moment you attempt to close the tree branch
onBeforeContextMenu fires before the context menu is called in the item area
onBeforeDelete fires before item deleting
onBeforeDrag fires before the mouse button is pressed and the cursor is moved over a draggable item
onBeforeDragIn fires before a dragged element is moved over the droppable area
onBeforeDrop fires before a dragged element is released over the droppable area
onBeforeDropOrder called when dnd reordering has been made, but not applied yet
onBeforeDropOut fires before a dragged element is released over the droppable area
onBeforeLoad occurs immediately before data loading has been started
onBeforeOpen fires the moment you attempt to open the tree branch
onBeforeRender occurs immediately before the component has been rendered
onBeforeSelect fires before item selection is started
onBeforeSort fires before sorting dataset
onBindRequest fires when the component is ready to receive data from the master component
onBlur fires when focus is moved out of the view
onDataRequest fires when data from the server is requested for linear data structures (List, DataTable, DataView etc.) to implement dynamic data loading
onDataUpdate fires when data item is in update process
onDestruct occurs when component destroyed
onDragOut fires when a dragged element is moved outside of the droppable area
onFocus fires when a view gets focus
onItemCheck fires when you check an item in tree and treetable
onItemClick fires when a component item was clicked
onItemDblClick fires when a component item was double-clicked
onItemRender for each item rendering, occurs only for items with custom templates
onKeyPress occurs when keyboard key is pressed for the control in focus
onLoadError fires when an error occurs during data loading ( invalid server side response )
onLongTouch fires on holding finger in some position for a certain period of time
onMouseMove fires when the mouse was moved over the specified component
onMouseMoving fires when the mouse was moved over the component
onMouseOut fires when the mouse was moved out from the specified item
onPartialRender called when part of tree is repainted
onPaste fires when the clipboard is enabled and the user presses CTRL+V keys combination
onSelectChange fires after selection state was changed
onSwipeX occurs on a horizontal swipe movement
onSwipeY occurs on a vertical swipe movement
onTimedKeyPress fires after typing has been finished in the field
onTouchEnd occurs when the touch event is ended
onTouchMove occurs during touch movement
onTouchStart when some webix view has been touched
onValidationError fires when newly loaded/added/edited data fails to pass validation
onValidationSuccess fires after the newlyloaded/added/edited data has passes validation successfully
onViewResize view size was changed by resizer
Properties
animate defines or disables view change animation.
borderless used to hide the component borders
click sets an action happening on a button click
clipboard enables/disables clipboard support
container an HTML container (or its id) where the component should be initialized
css the name of a css class that will be applied to the view container
data JavaScript array containing data for the component
datathrottle sets the polling interval (the time period between the completion of a network request and the next request for data)
datatype the type of loaded data
disabled indicates whether an item is enabled
drag enables or disables drag-and-drop
dragscroll enables autoscroll of component during drag-n-drop
filterMode defines the pattern for tree item filtering
gravity sets the view gravity (1 by default)
height sets the height of the component
hidden defines whether the view will be hidden initially
id the component ID
item alias to the type property
maxHeight sets the maximum height for the view
maxWidth sets the maximum width for the view
minHeight sets the minimal height for the view
minWidth sets the minimal width for the view
mouseEventDelay the delay between a real mouse action and invoking the related events
multiselect enables multiselect mode
navigation activates the selection keyboard navigation
on allows attaching custom handlers to inner events of the component
onClick attaches a click behavior for component items with the specified CSS class.
onContext a property used to define custom context-click (right click) handlers for elements in the DataTable cells
onDblClick attaches a dblclick behavior for component items with the specified CSS class.
onMouseMove attaches a mousemove behaviour for component items with the specified CSS class.
ready event handler called just after the component has been completely initialized
removeMissed defines how to treat items in case of reloading
rules set of validation rules for the component
save defines URLs for data saving
scheme defines schemes for data processing
scroll enables/disables the scroll bar
scrollSpeed the time during which the component is scrolled to the specified position (in milliseconds)
select enables/disables item selection or multiselection in grouplist
template the component template
templateCopy sets the template according to which data will be copied to the clipboard
threeState defines three-state checkboxes for the tree
tooltip sets a popup message appearing on pointing a mouse cursor over the dedicated item
type object that specifies items presentation
url the URL which the component will use to load data after its initialization
width sets the width of the component
Other
$drag method called when drag operation initiated
$dragHTML defines how dragged item will look
$dragIn method called when item moved on possible drop landing during dnd
$dragMark method called during drag-n-drop, when some item in the component should be marked as an active drop target
$dragOut method called when item moved out of possible drop landing during dnd
$drop method called when item dragged and dropped on valid target
$dropAllow can be redefined, if you need custom drop rules
$fixEditor applies editor adjusting logic to tree
$getSize returns the current size of the component
$height current height of the view
$scope scope for resolving event and method names
$setSize sets the component size
$skin the method which will be called when skin is defined
$view reference to top html element of the view
$width current width of the view
config all options from initial component configuration
data inner DataStore
name indicates the name of the component (a read-only property)
on_click redefines default click behavior for component items.
on_context a property used to define custom context-click (right click) handlers for elements in the DataTable cells
on_dblclick attaches a dblclick behavior for component items with the specified CSS class
on_mouse_move attaches a mouse move behavior for component items with the specified CSS class
type set of properties and helpers for item rendering
types collection of possible types
waitData eventual result of an asynchronous operation ('promise' object) for the loaded data
Back to top