With widget 1.x I used to do this and it works great with old Corona build…
[lua]
local tableViewOptions = {
top = 216,
left = 0,
width = screenWidth,
height = 220,
friction = 0.935,
backgroundColor = {0, 0, 0, 255},
noLines = false,
maskFile = assetsPath…“mask-220px.png”
}
tableView = widget.newTableView(tableViewOptions);
tableView.isLocked = true;
tableView.hideScrollbar = true;
group:insert(tableView)
for i = 1, 5 do
– onRender listener for the tableView
local function onRowRender( event )
local row = event.target
local rowGroup = event.view
local iconTbl = {assetsPath…“offersIcon.png”, assetsPath…“newsIcon.png”, assetsPath…“trainingIcon.png”, assetsPath…“reservationIcon.png”, assetsPath…“directionsIcon.png”}
local labelTbl = {“Offers”, “News”, “Training”, “Reservations”, “Find Us”}
local cellIcon = display.newImageRect(rowGroup, iconTbl[i], 18, 18);
cellIcon:setReferencePoint(display.CenterLeftReferencePoint);
cellIcon.x = 10;
cellIcon.y = 22;
local cellText = display.newText(rowGroup, labelTbl[i], 0, 0, “Helvetica”, 18)
cellText:setReferencePoint(display.CenterLeftReferencePoint);
cellText.x = 38;
cellText.y = 22 + textOffSet;
cellText:setTextColor(65, 150, 208, 255);
end
local rowHeight = 44
tableView:insertRow{
onEvent = onRowTouch,
onRender = onRowRender,
height = rowHeight,
rowColor = {0,0,0,255},
lineColor = {0,0,0,255}
}
end
[/lua]
however when I got the latest Corona build (stable public) and tried to migrate to Widget 2.0 I followed the docs and we should do this…
[lua]
local function onRowRender( event )
local row = event.row
local iconTbl = {assetsPath…“offersIcon.png”, assetsPath…“newsIcon.png”, assetsPath…“trainingIcon.png”, assetsPath…“reservationIcon.png”, assetsPath…“directionsIcon.png”}
local labelTbl = {“Offers”, “News”, “Training”, “Reservations”, “Find Us”}
local cellIcon = display.newImageRect(row, iconTbl[i], 18, 18);
cellIcon:setReferencePoint(display.CenterLeftReferencePoint);
cellIcon.x = 10;
cellIcon.y = 22;
-
local cellText = display.newText(row, labelTbl[i], 0, 0, “PFDinDisplayPro-Thin”, 18)
cellText:setReferencePoint(display.CenterLeftReferencePoint);
cellText.x = 38;
cellText.y = 22 + textOffSet;
cellText:setTextColor(65, 150, 208, 255);
end
tableView = widget.newTableView{
top = 216,
left = 0,
width = screenWidth,
height = 220,
friction = 0.935,
backgroundColor = {0, 0, 0, 255},
noLines = false,
isLocked = true,
--hideScrollbar = true,
maskFile = assetsPath…“mask-220px.png”,
listener = tableViewListener,
onRowRender = onRowRender,
onRowTouch = onRowTouch
}
group:insert(tableView)
tableView.isLocked = true;
tableView.hideScrollbar = true;
for i = 1, 5 do
local rowHeight = 44
tableView:insertRow{
rowHeight = rowHeight,
rowColor = {
default = { 0,0,0,255 },
over = { 64, 152, 205, 255 },
},
lineColor = {0,0,0,255}
}
end
[/lua]
Now the issue is that my tables with icons and labels won’t render, why is that and what can I do to fix it?
Confused…
Thanks
/C