Hi,
when I select a row in my tableRow its color changes, but if I select another row the first one mantain its new color.
How can I restore the default color in the first selected row?
I’ve tried this code:
function reloadTable()
local rowOptionList = {}
local count= tableView.getNumRows()
for i = count, 1, -1 do
row=tableView:getRowAtIndex( rowIndex )
row.RowColor={ default = { 255, 255, 255 }, over = { 217, 217, 217 },}
end
end
local function onRowTouch( event )
local phase = event.phase
local row = event.target
row:setRowColor( { default = { 1, 1, 1 }, over = { 1,1,1} } )
if "press" == phase then
reloadTable()
row:setRowColor( {default = { 0, 255, 255 }, over = { 0,0, 255, 0 } } )
strMazzo=row.params .. strFile[row.id].suffisso
end
end
tableView = widget.newTableView
{
top = 60,
left = 50,
rowHeight=16,
width = deviceWidth,
height = deviceHeight - 120,
backgroundColor = backColor,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
listener = tableViewListener,
}
group:insert( tableView )
local max=table.maxn(strFile)
for i=1, max do
rowColor = { default = { 255, 255, 255 }, over = { 217, 217, 217 },}
rParam = strFile[i].titolo --- string.sub(strFile[i],1,string.len(strFile[i])-4)
tableView:insertRow
{
id = i,
rowHeight = 32,
lineColor = lineColor,
-- At this line I get an error
rowColor=rowColor,
-- -------------------------------
fontColor=fontColor,
params = rParam
}
end
At the line:
rowColor=rowColor
I get an error.
How can I fix that?
Many thanks in advance.