Definition
function ScrollingTable:SetData(data)
Arguments
data
This is the only argument that you have to pass to this function. The data for your table must live in this argument.<br/> The structure of this argument is a little complex so I'll take it one level at a time.
data object
rows
The data object is an array of row objects.
{ row1, row2, row3, etc..., }
Each row object has the following structure:
{ ["cols"] = column object. ["color"] = { ["r"] = 1.0, ["g"] = 0.0, ["b"] = 0.0, ["a"] = 1.0, }, ["colorargs"] = nil, ["DoCellUpdate"] = nil, }
cols
The cols object structure is described below.
color
(Optional) A color object. Defaults to '''white'''.
colorargs
(Opional) An array of args that will be passed to the '''function''' specified for '''color'''. See color object. Defaults to (data, cols, realrow, column, table)
DoCellUpdate
columns
The column object is also an array of cell objects, one for each column.<br/> It is important that the size of the cols array is the same as the number of columns you have defined in '''CreateST'''.
{ cell1, cell2, cell3, etc..., }
Each cell object has the following format:
{ ["value"] = "Sachmo", ["args"] = nil, ["color"] = { ["r"] = 1.0, ["g"] = 1.0, ["b"] = 1.0, ["a"] = 1.0, }, ["colorargs"] = nil, ["DoCellUpdate"] = nil, }
value
Just like color objects, '''value''' can be a function or a value to display. If the type of '''value''' is a function, it is evaluated for display using the args table of arguments.
args
(Optional) An array of args that will be passed to the '''function''' specified for '''value'''. Defaults to (data, cols, realrow, column, table)
color
(Optional) A color object. Defaults to '''white'''.
colorargs
(Opional) An array of args that will be passed to the '''function''' specified for '''color'''. See color object. Defaults to (data, cols, realrow, column, table)
DoCellUpdate
Example
{ { ["cols"] = { { ["value"] = function(min, max) return math.random(min, max); }, ["args"] = { 1, 100, }, }, -- [1] Column 1 { ["value"] = "Row 1, Col 2", ["color"] = { ["r"] = 1.0, ["g"] = 1.0, ["b"] = 1.0, ["a"] = 1.0, }, -- Cell color }, -- [2] Column 2 }, }, -- [1] Row 1 { ["cols"] = { { ["value"] = "Row 2, Col 1", }, -- [1] Column 1 { ["value"] = "Row 2, Col 2", }, -- [2] Column 2 }, ["color"] = { ["r"] = 0.0, ["g"] = 1.0, ["b"] = 1.0, ["a"] = 1.0, }, -- Row color }, -- [2] Row 2 }
- 2 comments
- 2 comments
Facts
- Date created
- 09 Dec 2008
- Last updated
- 16 Sep 2009
- #2
ddumont Wed, 16 Sep 2009 12:55:17I am not notified via subscription email of comments made on pages, please post all comments on the main page or forum.
- #1
kronossx Tue, 30 Dec 2008 03:22:28i did
local data = {
{ ["cols"] = { { ["value"] = function(min, max) return math.random(min, max); }, ["args"] = { 1, 100, }, }, -- [1] Column 1 { ["value"] = "Row 1, Col 2", ["color"] = { ["r"] = 1.0, ["g"] = 1.0, ["b"] = 1.0, ["a"] = 1.0, }, -- Cell color }, -- [2] Column 2 }, }, -- [1] Row 1 { ["cols"] = { { ["value"] = "Row 2, Col 1", }, -- [1] Column 1 { ["value"] = "Row 2, Col 2", }, -- [2] Column 2 }, ["color"] = { ["r"] = 0.0, ["g"] = 1.0, ["b"] = 1.0, ["a"] = 1.0, }, -- Row color }, -- [2] Row 2}
but its not working :(