CreateST
Definition
function ScrollingTable:CreateST(cols, numRows, rowHeight, highlight, parent)
Arguments
cols
This arg is expected to be an array of tables that contain information about each column.
Each column table in the cols array should have the following format:
{ ["name"] = "Test 1", ["width"] = 50, ["align"] = "RIGHT", ["color"] = { ["r"] = 0.5, ["g"] = 0.5, ["b"] = 1.0, ["a"] = 1.0 }, ["colorargs"] = nil, ["bgcolor"] = { ["r"] = 1.0, ["g"] = 0.0, ["b"] = 0.0, ["a"] = 1.0 }, -- red backgrounds, eww! ["defaultsort"] = "dsc", ["sortnext"]= 4, ["comparesort"] = function (cella, cellb, column) return cella.value < cellb.value; end, ["DoCellUpdate"] = nil, }
name
The name to use as the column header.
width
The width in pixels that the column should be drawn.
align
(Optional) Alignment of values in the column. Must be one of ( "LEFT" | "RIGHT" | "CENTER" ) Defaults to "LEFT".
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)
bgcolor
(Optional) A color object. Defaults to clear. In other areas of lib-st, you will find that you can assign a function to return a color object instead. That is not the case with the bgcolor of a column.
defaultsort
(Optional) One of ( "asc" | "dsc" ). Defaults to "asc"
sortnext
(Optional) Must be a valid column number (lua indecies start at 1). Be careful with this value, you can chain across multiple columns, and get yourself into a circular loop.
comparesort
(Optional) A comparator function used to sort values that may not be easily sorted. ex. Dates... and stuff... Be sure to check for and call the comparator of the sortnext column if you wish to keep secondary column sort functionality. See the CompareSort method in Core.lua for an example.
DoCellUpdate
numRows
This arg defines how many rows you wish the table to show.
If nil, it will default to 12.
rowHeight
This arg defines how tall each row will be.
If nil, it will default to 15.
highlight
This arg defines the color object for the row highlight to use as you mouse-over a row.
If nil, it will default to mostly-yellow:
{ ["r"] = 1.0, ["g"] = 0.9, ["b"] = 0.0, ["a"] = 0.5, -- important, you want to see your text! }
In other areas of lib-st, you will find that you can assign a function to return a color object instead. That is not the case with the highlight of a column.
parent
This arg defines the frame that is to be used as the parent frame for the new scrolling table.
If nil, it will default to UIParent
re colorargs
what are being passed in by default? specifically, I want to color cell data based on it's row's column 3.
can I do
and then, in the function, switch on
or if not, how do I do it? :)
edit: I figured out the color arguments. you can't abstractly specify cell data at the column level. you have to do it when you create the table data's rows.
Basically, the usage is like:
I'm having a little trouble with the parent tag and AceGUI now. I have code like:
this create a group frame in my f frame. Later, I build my ST frame and pass it to grp:
Whe I run this, it doesn't work.
edi: after a lot of copy-pasting from AceGui internals, I got it working, mostly. Don't take this as a fix, it probably doesn't work completely, but here's what's gotten it to at least appear like a standard ace-gui widget:
I don't get subscription updates for comments to these pages. Please post comments on the main page, or make tickets for help if you still need it. thanks :)
local gui = LibStub("AceGUI-3.0") local con = LibStub("AceConsole-3.0") local libst = LibStub("ScrollingTable") local profFrame = gui:Create("Frame") profFrame:SetLayout("Fill") local table = libst:CreateST(nil, nil, nil, nil, profFrame)
Gives "CreateFrame: Couldn't find 'this' in parent object" (I was trying to get the test table into a frame of my own making)WARNING: The `parent` property is useless. The library defaults to showing the table in the center of UIParent (there's a line where the library runs SetPoint relative to UIParent). But you can quite easily make it work!
After that setup process, just `:Show()` and `:Hide()` the table as usual from then on...
In reply to Forge_User_03696397:
Thanks for pointing this out! I was getting so frustrated trying to figure out why this wasn't working... then I tried Ctrl+F "parent" on this page and found your comment. Even though it's been a couple years, I submitted this PR to get it fixed. Never too late, right?