WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Creating a grid/resultset (https://www.wowinterface.com/forums/showthread.php?t=50758)

fiote 12-16-14 07:17 PM

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.

Dridzt 12-16-14 07:39 PM

You could give LibSpreadsheet a try.

Example implementation addon: Gnomexcel

fiote 12-16-14 08:28 PM

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 =)

Duugu 12-16-14 09:28 PM

There is http://wowprogramming.com/docs/widgets/SimpleHTML. But I never used it and can't say anything about it.

Phanx 12-17-14 01:43 AM

Quote:

Originally Posted by Duugu (Post 302690)
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).

kurapica.igas 12-17-14 01:55 AM

1 Attachment(s)
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.

Attachment 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.


All times are GMT -6. The time now is 07:21 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI