Web Component: j-Tree
j-Tree
- jComponent
v19|v20
Configuration:
first
{Boolean}
selects the first tree item, default:true
(optional)exec
{String}
required: link to a function, this function is executed when the node is selected in the treeautoreset
{Boolean}
resets state when datas-source is changed (optional, default:false
)selected
{String}
selected class (optional, default:selected
)checked
{String}
optional, a path tofunction(arr, component)
or path toproperty
checkednested
{Boolean}
optional, checks all nested items (default:true
)upload
{String}
optional, a path tofunction(item, files)
(enables drag & drop files)dragdrop
{String}
optional, a path tofunction(item, target_item, itemel, targetel)
(enables drag & drop items)options
{String}
optional, a path tofunction(item, el)
enables a small button for an inline context menu for each itemrename
{String}
optional, a path tofunction(item, newname, fn_accept(true))
unselectexpand
{Boolean}
optional, canunselect
selected item when the user clicks on the expandable item (default:false
)reselect
{Boolean}
optional, evaluatesexec
again if the tree is refreshed (default:false
)selectexpand
{Boolean}
optional, enables addingselected
class to expandable items (default:false
)- NEW
iconoptions
{String}
icon to options (default:ti ti-ellipsis-h
) - NEW
expanded
{Boolean}
expands all children (default:false
)
Data structure:
- Object Array
- Object has to contain
name:String
andchildren:[another similar object]
orchildren:null
(with no children) - Object item can contain
..., icon: 'home' }
, it can change a file icon - Object item can contain
..., classname: 'css_custom_class' }
, it adds a CSS class onto the "label" element - Object item can contain
..., html: 'RAW_HTML'
{String} renders HTML tags instead ofname
field
Methods:
component.expand([index])
- expandsindex
orall
(with no definedindex
) nodescomponent.collapse([index])
- collapsesindex
orall
(with no definedindex
) nodescomponent.clear()
- clears a cache for refreshing the sourcecomponent.select(index)
- selects nodecomponent.unselect()
- unselects nodecomponent.rename(index)
- showsinput
for name renaming (it works withconfig.rename
)
Good to know:
Setter automatically extends each object by adding .$pointer
property with a tree index.
Author
- Peter Širka petersirka@gmail.com
- License
Created
29. july 2017
Updated
25. august 2023
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Dark mode
Yes
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com