I have a tableView and how to see in the image the date is from the smallest date to the largest and I wanted to know how I can reverse this for the more recent things that I put staying in the afternoon from above and the older ones on the bottom[lua]
local function onRowRender( event )-- metodo para preencher o tableView
–Set up the localized variables to be passed via the event table
local row = event.row
local id = row.index
row.bg = display.newRect( 0, 0, display.contentWidth, 60 )
row.bg.anchorX = 0
row.bg.anchorY = 0
row.bg:setFillColor( 1, 1, 1 )
row:insert( row.bg )
row.data = display.newText("data: "… tabelaDaPublicacao[id].data, 12, 0, native.systemFontBold, 18 )
row.data.anchorX = 0
row.data.anchorY = 0.5
row.data:setFillColor( 0 )
row.data.y = 15
row.data.x = 42
row.localidade = display.newText("local: "…tabelaDaPublicacao[id].localidade, 12, 0, native.systemFont, 18 )
row.localidade.anchorX = 0
row.localidade.anchorY = 0.5
row.localidade:setFillColor( 0.5 )
row.localidade.y = 33
row.localidade.x = 42
local options =
{
text = "descricao: "… tabelaDaPublicacao[id].descricao ,
x = 12,
y = 0,
width = 250,
height = 58,
font = native.systemFont,
fontSize = 17,
align = “left” – Alignment parameter
}
row.descricao = display.newText(options)
row.descricao.anchorX = 0
row.descricao.anchorY = 0.5
row.descricao:setFillColor( 0.5 )
row.descricao.y = 70
row.descricao.x = 42
row.status = display.newText("status: " …tabelaDaPublicacao[id].status, 12, 0, native.systemFont, 18 )
row.status.anchorX = 0
row.status.anchorY = 0.5
row.status:setFillColor( 0.5 )
row.status.y = 115
row.status.x = 42
row:insert( row.data )
row:insert( row.localidade )
row:insert( row.descricao )
row:insert( row.status )–
return true
end[/lua]
Method that receives the table with the information
[lua]
function recebeTabelaDaPublicacao(tabela) – metodo que recebe a tabela de publicacao e define o tamanho de cada campo do tableView
tabelaDaPublicacao = tabela
for dis,dat in ipairs(tabela) do
–print(dis … “-” … dat.data)
myList:insertRow{
rowHeight = 125,
isCategory = false,
rowColor = { 1, 0.2, 0.1 },
lineColor = { 1, 0.20, 0.70 }}
end
end[/lua]
Tableview creation
[lua]function scene:show(event)
myList = widget.newTableView {
top = 40,
width = display.contentWidth,
height = ButtonProfile.y - 70,—display.contentHeight * 0.80,
HideBackground = true ,
onRowRender = onRowRender,
onRowTouch = onRowTouch,
listener = scrollListener
}
grupoCena:insert( myList)
end[/lua]