lib-ScrollingTable
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: https://github.com/ddumont/lib-st.git 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
Hi!
Thanks for pointing that out. but I'd recommend using the latest tagged and stable version for testing. Right now the alphas are unstable, I'm trying to put some new support in for someone and haven't had good solid chunks of time to spend on it yet.
Hi DDumont,
The latest version of this library appears to have a bug. fRealRow should be renamed to isRealRow.
It's messing up the sorting in my mod and I was hoping to get my new mod approved for release this week.
Thanks!
Are you going to put it on wowace? I'd like to link back to you if you decide to use my library. I'm also interested in growing my generated points/day :)
something else
Are you using this for WIM? Or has the project not surfaced on wowace yet?
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
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.
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'?
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.
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
That would be 1 row containing 2 columns.
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
Do you have any sample code?
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?
Pm is fine. Email is better.( I sent you a pm with it)
If you think it would help onyone else out using the mod, comments are good too.
Hi ddumont,
I'm going to renew my work on a project of mine I call "Socialist", which tracks all of the players you've come across and grouped with on a variety of realtime-searchable criteria. The major hangup I had last time was in UI design, something I find rather baffling. I think that using your library will make writing the addon a real breeze.
I was wondering if there is a way I can contact you if I have questions about how to implement the library - perhaps via PM, perhaps email, or maybe IRC or AIM?
Thanks.
A notice to anyone use this mod:I will be converting it to a true ace library soon that you can use to package with your mod. You won't be able to embed it and use mixins... but you will be able to reference it, create tables... and hopefully allow it to be updated by other copies of the library.From here on out (post version r74) alpha builds may get unstable. Just a heads up.Edit: The mod is now a proper library :)
ticket it up :)
heya, any chance this is usable as an AceGUI-element? If not I'd post an enhancement request ticket (if you don't mind).
thx
There's now a big shiny donate button for those of you with generous hearts out there ;D