Module vTree
Tree view, used for displaying hierarchical data
self.selection |
(vSelection) |
self.selected_index |
(int) the index of the (first) selected item |
self.require_selection |
(bool) enforce that at least one item remains selected at all times |
self.data |
(table>row>col:variant) the data
an extra property, item_id, is added runtime |
self.autosize |
(bool) automatically resize to fit number of rows |
self.num_rows |
(int) number of visible rows |
self.row_height |
(int) row height |
self.row_offset |
(int) offset, vertical "scroll" position |
self.indent |
(int) amount of identation in pixels |
self.icon_width |
(int) the horizontal size of node-icons |
self.on_resize |
(function) fired on automatic resize |
self.on_toggle |
(function) fired when nodes are expanded or collapsed
note: you can define particular handler on a node-basis by
specifying it as part of the node definition when setting data |
self.on_select |
(function) fired when a node (text label) is clicked
note: you can define particular handler on a node-basis by
specifying it as part of the node definition when setting data |
self.on_update_complete |
(function) fired after each update
this method can be used for custom decorators etc. |
self._selection_notifier |
(function) callback function for when selection has changed |
Functions
-
fit_rows_width ()
-
resize rows
-
update ()
-
update table using current settings (rebuild if needed)
-
update_tree (t, depth)
-
recursive method, will iterate through table and update each row
Parameters:
-
get_visible_row_count (t)
-
get the number of rows in the data which can be shown
(used for determining range of the scrollbar)
Parameters:
-
parse_data (t)
-
+ add a unique id to all nodes, and cache this (.map)
+ initialize the "expanded" attribute
Parameters:
-
autosize_to_contents ()
-
call this the computed height of the table has changed -
if resized, the external resize handler is invoked
-
load_file (file_path)
-
load data from an external source
note: each file format needs to implement the load_and_parse() method
Parameters:
- file_path
(string) source file - if undefined, file browser is shown
-
selection_handler (changed, added, removed)
-
update display after having called the selection class
Parameters:
-
set_data (data)
-
Getters and setters
Parameters:
-
set_selected_indices (t)
-
[[
Parameters:
Fields
-
self.selection
-
(vSelection)
-
self.selected_index
-
(int) the index of the (first) selected item
-
self.require_selection
-
(bool) enforce that at least one item remains selected at all times
-
self.data
-
(table>row>col:variant) the data
an extra property, item_id, is added runtime
-
self.autosize
-
(bool) automatically resize to fit number of rows
-
self.num_rows
-
(int) number of visible rows
-
self.row_height
-
(int) row height
-
self.row_offset
-
(int) offset, vertical "scroll" position
-
self.indent
-
(int) amount of identation in pixels
-
self.icon_width
-
(int) the horizontal size of node-icons
-
self.on_resize
-
(function) fired on automatic resize
-
self.on_toggle
-
(function) fired when nodes are expanded or collapsed
note: you can define particular handler on a node-basis by
specifying it as part of the node definition when setting data
-
self.on_select
-
(function) fired when a node (text label) is clicked
note: you can define particular handler on a node-basis by
specifying it as part of the node definition when setting data
-
self.on_update_complete
-
(function) fired after each update
this method can be used for custom decorators etc.
-
self._selection_notifier
-
(function) callback function for when selection has changed