Skip to content

a table for godot with build in helper and sorter functions

License

Notifications You must be signed in to change notification settings

EinRainerZufall/godot_tree_table

Repository files navigation

GitHub Downloads (all assets, all releases)

godot_tree_table

A simple table node with built-in sorter

To add: Control/Container/PanelContainer/Table

Sorter

The built-in sorter is activated by left-clicking on the corresponding header column and toggles between ascending and descending. Right-click to return to the original order. Empty cells are created as "----" and are always at the end of the table when sorting.

built-in functions

set_table

func set_table(new_table:Array[Array]) -> void:

Sets the passed array as a table, the inner arrays are automatically adjusted to the number of columns, if they are expanded the text is set to "----". If auto_reload is active, the table is automatically
updated when the passed array changes.

add_row

func add_row(new_row:Array) -> void:

Adds a new row, the array is automatically adjusted to the number of columns, if they are expanded the text is set to "----".

remove_last_row

func remove_last_row() -> bool:

Deletes the last row, does not return an error if the table is empty. If a row has been removed, True is returned, otherwise False

remove_row_at

func remove_row_at(index:int) -> void:

Deletes the row at the specified index (0 based). A positive index is counted from the beginning, a negative index is counted from the end. Returns an error if the specified index does not exist.

reload_table

func reload_table() -> void:

Reloads the table. The manual way if the array that was set with set_table has changed.

Signals

Available signals

signal CLICK_CELL_DATA(cell:String)
signal CLICK_CELL_POS(pos:Vector2i)
signal CLICK_ROW(row:Array)
signal CLICK_ROW_INDEX(index:int)
signal DOUBLE_CLICK(pos:Vector2i, key:Key)

The CELL signals are only available if the table_select_mode is set to CELL

About

a table for godot with build in helper and sorter functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published