Client
Exports for handling data table UIs.
open
Opens a new data table interface with headers, data, and action buttons.
exports.rw_datatables:open(data)
-
data:
table
-
id:
string
Unique identifier for this table instance. -
head:
string[]
List of column names for the table header. -
list:
string[][]
A 2D table of rows, where each row is a table of strings that correspond to each column defined inhead
. Example:{ { "123", "John Doe", "Leader", "true" }, { "456", "Jane Doe", "Member", "false" } }
-
onClose?:
function()
A callback executed when the table is closed. -
actions?:
table<string, function(index: number, data: table)>
Defines action buttons that can be clicked for each row.- index: Row number clicked (1-based).
- data: Table containing that rowβs values.
-
Example
exports.rw_datatables:open({
id = "Title",
head = { "id", "Name", "Label", "Ceo" },
list = {
{ "101", "Alpha Crew", "Security", "true" },
{ "102", "Beta Crew", "Transport", "false" }
},
onClose = function()
print("Closed crew table")
end,
actions = {
["β¬οΈ Go To"] = function(index, data)
local id = tonumber(input[1])
ExecuteCommand(("tp %d"):format(id))
end,
["ποΈ Remove Job"] = function(index, data)
local id = tonumber(input[1])
ExecuteCommand(("setjob %d unemployed"):format(id))
end,
["β Kick"] = function(index, data)
local id = tonumber(input[1])
ExecuteCommand(("kick %d "):format(id))
end
}
})
Arguments Summary
- id:
string
β Unique name for the table window. - head:
string[]
β Column headers. - list:
string[][]
β Rows of data matching header order. - onClose:
function()
β Triggered when closing the UI. - actions:
table<string, function(index: number, data: table)>
β Named actions.