+ Reply to Thread
Results 1 to 6 of 6
Like Tree2Likes
  • 1 Post By DoomSprout
  • 1 Post By Zanderfied

Thread: Need help with DataTables

  1. #1
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default Need help with DataTables

    Ok so i've been trying to get into the Yague library, my only problem is that there is no documentation

    Source: rift.curseforge.com/addons/yague/

    Code:
    playerGrid:SetPoint("TOPLEFT", mainWindow, "TOPLEFT", 20, 66)
    playerGrid:SetPadding(1, 1, 1, 38)
    playerGrid:SetHeadersVisible(true)
    playerGrid:SetRowHeight(62)
    playerGrid:SetRowMargin(2)
    playerGrid:SetLayer(5)
    playerGrid:SetHeight(510)
    playerGrid:SetWidth(698)
    playerGrid:SetUnselectedRowBackgroundColor({0.15, 0.1, 0.1, 1})
    playerGrid:SetSelectedRowBackgroundColor({0.45, 0.3, 0.3, 1})	
    playerGrid:AddColumn("item", "Player", SearchCellType, 80, 3, nil, "itemName")
    playerGrid:AddColumn("level", "Level", "Text", 120, 1, "sellerName", true, { Alignment = "center" })
    playerGrid:AddColumn("note", "Note", "Text", 300, 1, "sellerName", true, { Alignment = "center" })
    playerGrid:SetOrder("item", false)
    playerGrid:GetInternalContent():SetBackgroundColor(0, 0.05, 0.05, 0.5)
    playerGrid:SetLoadingBarEnabled(true)
    
    local values = {{	{ value = "one", key = 1},
    			{ value = "two", key = 2},
    			{ value = "three", key = 3}
    			}} -- 1 row with 3 columns
    
    
    
    playerGrid:SetData(values, nil, nil, true)
    Everything is fine until it comes to SetData,

    http://clip2net.com/clip/m236383/140...-clip-14kb.jpg

    I'm obviously entering the data in the wrong format, I've looked through the function SetData in DataTables.lua of the Yague Library but can't for the life of me work out what format is needed to fill out the multiple columns.

    I CAN add multiple rows with no problem but only the first column will be filled, the other 2 will say nil so its attempting to get the data somehow I'm just not giving it right.

    PS In Yague Library you are looking at DataGrid.lua

    Can someone please take a moment to help me get passed this?
    Last edited by Zanderfied; 06-05-2014 at 10:54 PM.

  2. #2
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    I had a quick look at the Yague code, but I need more caffeine

    I'd probably try something like:

    Code:
    local values = 
    {
        ["one"] = { item = 'Player One', level = 60, note = 'Hello 1' },
        ["two"] = { item = 'Player Two', level = 51, note = 'Hello 2' },
        ["three"] = { item = 'Player Three', level = 55, note = 'Hello 3' },
    }
    ...but that's just a guess at how the data is likely to be defined - each row having a primary key linked to a set of key/value pairs.
    Last edited by DoomSprout; 06-05-2014 at 10:59 PM.

    Gadgets: Unit Frames and Other Stuff for RIFT

  3. #3
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default

    Hey man, thanks

    This was the result though

    http://clip2net.com/clip/m236383/140...-clip-35kb.jpg

  4. #4
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default

    With:
    Code:
    local values = 
    {
        "Hello",
    	"World",
    }
    This was the result: http://clip2net.com/clip/m236383/140...-clip-15kb.jpg

    So it leads me to believe that there is a string split but I can't find it

  5. #5
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    Sorry, I can't work out how it works - I tried working through the code, but my brain started leaking out of my ears

    If I spot Baanano online, I'll point him this way.

    - Wild

    Gadgets: Unit Frames and Other Stuff for RIFT

  6. #6
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default

    I actually solved this after digging very deep in his BananAH

    Code:
    local values = {
    values[1] = { player = "col1", level = "col2", role = "col3"}
    values[2] = { player = "col1", level = "col2", role = "col3"}
    playerGrid:SetData(values, nil)
    which now I realise is what you said lol, I must of fixed something
    Last edited by Zanderfied; 06-06-2014 at 08:46 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts