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

A custom display function.

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


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes