I’m having trouble figuring out how to go about inserting display groups to TableView rows.
I’ve read the thread above carefully, but I’m still not getting it.
I also looked at Corona documentation:
http://docs.coronalabs.com/api/library/widget/newTableView.html
http://docs.coronalabs.com/api/type/TableViewWidget/insertRow.html
Sample code that comes bundled with Corona SDK does not offer any insight as to what I need to do either.
So, as autolib noted up top, I feel Corona hasn’t really offered any documentation or sample code anywhere that could help us – or perhaps they are so very hidden that I’ve failed to find them, or I just don’t know what to look for – so here I am, still no solution in sight.
Here’s what I’ve tried. Clearly, I’m missing something, but I don’t know what that is:
[lua]
– localGroup is self.view in composer
– myTable is a local variable forward referenced up top
local imageGroup = {}
local onRowRender = function()
--[[
Here I created display groups:
imageGroup[1]
imageGroup[2]
imageGroup[3]
imageGroup[4]
imageGroup[5]
Each of these display groups has 4 pieces of display objects inside
--]]
local row = event.row
local rowH = row.contentHeight
local rowW = row.contentWidth
for i=1,5 do
myTable:insertRow{
rowHeight = 55
}
row:insert( imageGroup[i] )
end
end
local onRowTouch = function()
– do whatever needs to be done onRowTouch
end
myTable = widget.newTableView
{
width = 230,
height = 240,
backgroundColor = { 0.9, 0.9, 0.9 },
hideBackground = false,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
}
localGroup:insert( myTable )
myTable.x = display.contentCenterX-120; myTable.y = display.contentCenterY+20
[/lua]
Why don’t I see the display groups neatly appearing in row inside the TableView object? What am I missing? Could it be possible that TableView cannot hold display groups – could it be the reason why my attempt would never work?
I’d so appreciate any help anyone can offer.
Naomi