Skip to content

Table : VisualElement

This is the table class. It provides a sortable data grid with customizable columns, row selection, and scrolling capabilities.

Properties

PropertyTypeDefaultDescription
columnstable{}List of column definitions with {name, width} properties
datatable{}The table data as array of row arrays
selectedRownumber?nilCurrently selected row index
headerColorcolorblueColor of the column headers
selectedColorcolorlightBlueBackground color of selected row
gridColorcolorgrayColor of grid lines
sortColumnnumber?nilCurrently sorted column index
sortDirectionstring"asc"Sort direction ("asc" or "desc")
scrollOffsetnumber0Current scroll position

Functions

MethodReturnsDescription
Table:sortDataTableSorts the table data by the specified column

Protected Functions

MethodReturnsDescription
Table:initTableInitializes the Table instance
Table:mouse_clickbooleanHandles header clicks for sorting and row selection
Table:mouse_scrollbooleanHandles scrolling through the table data
Table:render-Renders the table with headers, data and scrollbar

Table:sortData(columnIndex)

Sorts the table data by column

Parameters

  • columnIndex number The index of the column to sort by

Returns

  • Table self The Table instance

Released under the MIT License.