lib-ScrollingTable

UI Events

Events have changed in lib-st.

You can now register any event you want for your scrolling table, and these events will be fired for each cell.

To register your event call the function '''RegisterEvents''' and pass in a table of your events paired with their handlers:

local st = ScrollingTable:CreateST();
st:RegisterEvents({
    ["OnClick"] = function (rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
        --[[ handle onclick event here ]]--

        --[[ return true to have your event override the default one
             return false, or nothing at all to have the deafult handler 
                processed after yours.
             The default OnClick handler for example, handles column sorting clicks.
             if row and realrow are nil, then this is a column header cell ]]--
        
    end,
});

Arguments

All event handlers will be supplied the following arguments...

rowFrame

This is the UI Frame table for the row.

cellFrame

This is the UI Frame table for the cell in the row.

data

This is the data table supplied to the scrolling table (in case you lost it :) )

cols

This is the cols table supplied to the scrolling table (again, in case you lost it :) )

row

This is the number of the UI row that the event was triggered for.<br/> ex. If your scrolling table only shows ten rows, this number will be a number between 1 and 10.

realrow

This is the exact row index (after sorting and filtering) in the data table of what data is displayed in the row you triggered the event in. (NOT the UI row!)

column

This is the index of which column the event was triggered in.

scrollingTable

This is a reference to the scrollingtable table.

...

Any arguments generated by the '''NORMAL''' Blizzard event triggered by the frame are passed as is.

Hint

To aquire the actual data of the cell for the event that was triggered, you can do this in your handler function:

local celldata = data[realrow].cols[column];

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

  • 1 comment
  • Avatar of Shirkah Shirkah Nov 15, 2012 at 16:41 UTC - 0 likes

    If I try to call the function RegisterEvents I got a nil error

    attempt to call method 'RegisterEvents' (a nil value)

    local sstScroll = ScrollingTable:CreateST(cols,20,20,nil,frame.frame); sstScroll.frame:SetPoint("TOPLEFT",frame.frame,"TOPLEFT",15,-40) sstScroll:RegisterEvents({ ["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end, ["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end, });

    Any suggestions?

  • 1 comment