lib-ScrollingTable

lib-st in action!

lib-st provides a convenient way to create and display a scrolling table of data.
Supply column info and your table data, and you're off!

To get a handle in lua:

local ScrollingTable = LibStub("ScrollingTable");

To package in your addon, add to your .pkgmeta file:

externals:
    Libs/lib-st: 
        url: svn://svn.wowace.com/wow/lib-st/mainline/trunk
        tag: latest

Leave off the tag line if you want the absolute lastest alpha version from the site. (I try to keep a stable copy tagged as latest)

New Features:

Added support for calling SetData with a minimal dataset which can drastically reduce the number of tables that exist within the mod... at a slight cost to customization.

Other recent changes

If no args or colorargs are specified for value and color functions, respectively, instead of no args, these args will be passed:

function (data, cols, realrow, column, sttable)  
    -- sttable is a reference to the scrolling table
end

Here's some nitty-gritty:

  • Set names and widths of columns, lib-st will set the table width on it's own!
  • Set the number of rows, and a value to use for row height, lib-st will set the table height on it's own!
  • Set background colors for each column.
  • Set column text alignment.
  • Set column text color.
  • Set row text color.
  • Set text color on a cell-by-cell basis.
  • Supply functions to be evaluated for cell data, and cell/row/column text colors!
  • Filter table data via a filter funtion.
  • Table sorts are NON-DESTRUCTIVE. Data or the order of data supplied is never changed (unless modified by user supplied functions) for the display of the table. No copies of the data are made either. 1 Table, your data, sort it, index it as it was when it was created, update it as you see fit.
  • Hookable ui events. find out more here
  • Custom cell formatting with a custom display function
  • Enable selection on your scrolling table


Find out how to create a scrolling table using lib-st!
Let me know if you use it!!

-> Screenshots

Known consumers of lib-st

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of StewartA StewartA Dec 05, 2009 at 19:11 UTC - 0 likes

    something else

  • Avatar of ddumont ddumont Dec 05, 2009 at 18:59 UTC - 0 likes

    Are you using this for WIM? Or has the project not surfaced on wowace yet?

  • Avatar of StewartA StewartA Dec 05, 2009 at 18:57 UTC - 0 likes

    Done: http://www.wowace.com/addons/lib-st/tickets/23-set-data-format-change/

    And yes, I'm working with about 5 different tables having between 100 and 3000 rows each, it starts stacking up VERY quickly

  • Avatar of ddumont ddumont Dec 05, 2009 at 18:41 UTC - 0 likes

    probably, I can look into it. Can you create an enhancement ticket for it?

    Why all the concern over memory? Are you planning on surfacing an insane amount of data?

    The table is only ever created once, after that it's contents do not change. Internally I have a few tables for sorting indices and such... but once it's created, that's it.

  • Avatar of StewartA StewartA Dec 05, 2009 at 17:19 UTC - 0 likes

    Comparing your 'minima' example to mine, (Using the table i posted as the example, simple 12 cell 3x4 table, very small) Your layout requires 17 tables whereas mine requires just 5. Add more columns and lots of rows and the number of tables required very quickly reaches stupid proportions. At 40 bytes per table (ignoring the elements) the memory size of the data table can very quickly reach stupid proportions, and if you're rebuilding the table more often than once in a blue moon then that's a lot of garbage.

    Example: 100 rows, 5 columns, the current design requires at least 601 tables as opposed to 101.

    And that's just the data table, I don't know what you're doing with it on the inside, but last time i tried it out, rebuilding a 5 column, 70 row table used silly amounts of memory

    I guess my point is that if you can check if a value is a 'value' or a 'function', could you check if the cell object is a table like your current design requires or just a straight 'value'?

  • Avatar of ddumont ddumont Dec 05, 2009 at 16:32 UTC - 0 likes

    It's true that it's probably easier to programatically generate the tables for lib-st.

    It's actually very simple to take your example table and return a table suitable for lib-st. Would be a small function.

  • Avatar of ddumont ddumont Dec 05, 2009 at 16:29 UTC - 0 likes

    Actually most of the formatting is purely optional... and your table there isn't really far off from the minimal dataset needed.

    also you might want to specify the column names.. but that's about it.

    try

    { 
        ["cols"] = { 
            {["value"] = "col1",}, 
            {["value"] = "col2",} 
        }, 
    }
    

    That would be 1 row containing 2 columns.

  • Avatar of StewartA StewartA Dec 05, 2009 at 00:27 UTC - 0 likes

    I don't suppose it would be possible to get a 'simpler' version of the library, one that lets you have a simple square table for data without all the complicated formatting it needs at the moment.

    It's nice to be able to specify formatting on a cell-by-cell basis, but i would imagine that 98% of the time it's not really neccesary, and all those extra lua tables use a whole lot of memory when you've got a couple of big tables to manage.

    I'm talking just a simple initialization of the table, column headers etc, then a data table in the format

    data = {
        { "Row1Cell1", "R1C2", "R1C3" },
        { "R2C1", "R2C2", "R2C3" },
        { "R3C1", "R3C2", "R3C3" },
        { "R4C1", "R4C2", "R4C3" },
    };
    
    Last edited Dec 05, 2009 by StewartA
  • Avatar of ddumont ddumont Sep 30, 2009 at 12:14 UTC - 0 likes

    Do you have any sample code?

  • Avatar of evman182 evman182 Sep 30, 2009 at 03:29 UTC - 0 likes

    I'm trying to anchor the table to the bottom of the frame i placed it in, but it continues to show up in the center of the frame. Suggestions?

Facts

Date created
Oct 14, 2008
Categories
Last update
Jun 06, 2011
Development stage
Mature
License
GNU General Public License version 2 (GPLv2)
Curse link
lib-ScrollingTable
Reverse relationships
12
Downloads
12,141
Recent files
  • R: v4.0 for 4.1 Jun 06, 2011
  • A: r145 for 4.1 Jun 06, 2011
  • R: v3.9 for 4.0.6 Jun 06, 2011
  • A: r143 for 4.0.6 Jun 06, 2011
  • A: r142 for 4.0.6 Apr 25, 2011

Authors

Relationships

Embedded library
LibStub