Richard, thanks again,
I got it to display my data on each row as I needed, but now there’s a small problem:
I have two arrays, one for the data catagory and another for the data itself. I can’t seem to display both arrays for the same row. For now I display the data when that row is pressed but it goes away on release. Is there a way around this? Here is the code (“cat” is the catagory array and “plyr_data” is the data itself):
[code]
– onEvent listener for the tableView
local function onRowTouch( event )
local row = event.target
local rowGroup = event.view
if event.phase == “press” then
if not row.isCategory and row.title then
row.title.text = plyr_dat[event.index]
row.title:setReferencePoint( display.CenterLeftReferencePoint )
row.title:setTextColor( 100,100,255 )
row.title.x = 200
end
elseif event.phase == “release” then
if not row.isCategory then
row.reRender = true
print( plyr_dat[event.index])
end
end
return true
end
– onRender listener for the tableView
local function onRowRender( event )
local row = event.target
local rowGroup = event.view
local textFunction = display.newRetinaText
if row.isCategory then textFunction = display.newEmbossedText; end
row.title = textFunction( cat[event.index], 12, 0, native.systemFontBold, 16 )
row.title:setReferencePoint( display.CenterLeftReferencePoint )
row.title.y = row.height * 0.5
if not row.isCategory then
row.title.x = 15
row.title:setTextColor( 0 )
end
– must insert everything into event.view:
rowGroup:insert( row.title )
end
– Add 6 rows, and two categories to the tableView:
for i=1,6 do
local rowHeight, rowColor, lineColor, isCategory
– insert the row into the tableView widget
list:insertRow{
onEvent=onRowTouch,
onRender=onRowRender,
height=rowHeight,
isCategory=isCategory,
rowColor=rowColor,
lineColor=lineColor
}
end
end
[/code] [import]uid: 95689 topic_id: 18896 reply_id: 73109[/import]