Hi all,
I simply cant find a way to do this… hope its simple and im just missing something, it’s driving me a bit crazy!
I have a table that looks like this:
mytable["category1"] = { {name="row1"}, {name="row2"}, } mytable["category2"] = { {name="row3"}, {name="row4"}, } mytable["category3"] = { {name="row5"}, {name="row6"}, }
I want to create category rows for each category, and then have their child rows underneath each one.
The problem I keep running into is, in the rowRender listener for the tableView, I only have access to row.index to get data back out of the source table (“mytable”). I need to know the category too!
This works:
local function onRowRender(event) local phase = event.phase local row = event.row local sometext = display.newText(mytable["category1"][row.index].name,0,0); sometext:setTextColor( {0,0,0} ) -- black row:insert(sometext) end
…But only for “category1” rows. But in place of [“category1”] here, I need to somehow pass in whether the data for that row is category1, category2, category3 according to the heiracy of “mytable”.
What’s the trick?