Thread Tools Display Modes
12-16-14, 07:17 PM   #1
fiote
A Defias Bandit
 
fiote's Avatar
Join Date: Nov 2010
Posts: 2
Creating a grid/resultset

Hello everyone!

Soooo, I got a array/table-thing that stores a list of gear items. Every 'row' in this table got several attributes, like name, ilvl, type/subtype, etc.

Based on filters that I already implemented on that table, I need to display N rows like a table (like a html table), one below the other.

Being a (I guess?) good developer, I did what I could with what I already now and managed to create a ton of 'labels' with CreateFontString and set them (using SetPoint) to be positioned relative to one another in a way that pretty much can be seem as a table (like, the first label of the first row is set to start a BOTTOMLEFT from the first label of the table header, and the first label o fthe second row is set to start at BOTTOMLEFT of the first label of the first row and so on).

I'm kinda happy with the result, but I can't help to think that there should be another way, a better way (simpler) to do that.

Can someone point me the way? Is there a class/frame/something-like-that to abstract this kind of think?


This is my first post here, lol. I used the search but didn't quite find the anwser.
  Reply With Quote
12-16-14, 07:39 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
You could give LibSpreadsheet a try.

Example implementation addon: Gnomexcel
  Reply With Quote
12-16-14, 08:28 PM   #3
fiote
A Defias Bandit
 
fiote's Avatar
Join Date: Nov 2010
Posts: 2
Hey @Dridzt,

Yeah, I'm looking at that right now lol. Got some bugs (and by bug I mean 'not exaclty how I want it to work') but i'm trying to fix them.

Looking at its code, it seems that no, there is no 'easy way' to make grids. They create a TON of elements too (but it create one frame per row, which is way clever than what I did).

Well, thanks a lot! I guess this will do =)
  Reply With Quote
12-16-14, 09:28 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
There is http://wowprogramming.com/docs/widgets/SimpleHTML. But I never used it and can't say anything about it.

Last edited by Duugu : 12-16-14 at 09:31 PM.
  Reply With Quote
12-17-14, 01:43 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Duugu View Post
There is http://wowprogramming.com/docs/widgets/SimpleHTML. But I never used it and can't say anything about it.
It doesn't support tables. It only supports h1, h2, h3, p, img, br, and a (href attribute is an item, spell, or other in-game link type).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-17-14, 01:55 AM   #6
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
SimpleHTML don't support <table> elements, no <input>, no <select>, can only be used as some guide with hyper-links.

For the datagrid, I only suggest two things:

1. don't create one widget element row for each data row, just draw the rows that the panel can hold, and refresh them when the scroll bar's value is changed.

2. Try using editbox for each cell, you can control it by EnableMouse API, disable it to make it works like a fontstring, enable it for editing.

I created a DataGrid class long time ago, it's defined in a full oop language style, can't say it's in a simpler way because it's based on a big lib, and it's not finished yet because I don't see where I can use it.

Click image for larger version

Name:	datagrid.jpg
Views:	173
Size:	97.2 KB
ID:	8368

It's abandoned also because for now I have an element panel interface, I can give any type of element (like button, fontString, also custom widget classes) to it with row count, column count, horizontal spacing, vertical spacing, margin settings and etc to generate a grid, the grid don't really care what type the elements are. So, if you want build some framework, you also can try to build something like this to do the dirty work.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Creating a grid/resultset

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off