lib-st is a factory. It creates and returns an instance of a scrolling table for you to use.
To create a scrolling table
local ScrollingTable = LibStub("ScrollingTable"); local table = ScrollingTable:CreateST();
Calling CreateST without any arguments will return a default testing table.
Click here for more info on the CreateST function.
After creating a scrolling table, you have to load it with data.
Click here for more information on the SetData function.
You can register event handlers for various frame events!
Click here for more information on the RegisterEvents function.
The sorting of the table is NON-DESTRUCTIVE. This means that the order of rows will remain the same, and you can update the data table after you have set it with new information if you need to. If you update data that needs to be sorted, call the SortData function on the scrolling table.
If you just want to update a color value, a simple Refresh call will do fine.
local ScrollingTable = LibStub("ScrollingTable"); local table = ScrollingTable:CreateST(cols); table:SetData(data); -- if data is updated table:SortData(); -- no need to call Refresh, it is called internally. -- if a color is updated table:Refresh(); -- set a row filter function table:SetFilter(fnFilter);
example filter function:
fnFunction = function(self, row) -- only show rows who's 1st column value is > 10 local show = false; if row.cols.value > 10 then show = true; end return show; end;
Assigning a filter function will resort your table. Remember, you can edit the data set you supply to the scrolling table at any time to update the display. Even removing or adding rows. It's a good idea in practice to resort the table after an edit.
- Date created
- Dec 09, 2008
- Last updated
- Jun 04, 2009