= row.name i=i+1 nameText = row.name print(nameText) end -- Forward reference for our tableView local tableView = nil -- Listen for tableView events local function tableViewListener( event ) local phase = event.phase print( "Event.phase is:", event.phase ) end -- Handle row rendering local function onRowRender( event ) local phase = event.phase local row = event.row local rowTitle = display.newText( row, ""..nameText, 0, 0, nil, 14 ) rowTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitle.contentWidth \* 0.5 ) + LEFT\_PADDING rowTitle.y = row.contentHeight \* 0.5 rowTitle:setTextColor( 245, 245, 245 ) end -- Handle row updates local function onRowUpdate( event ) local phase = event.phase local row = event.row --print( row.index, ": is now onscreen" ) end -- Handle touches on the row local function onRowTouch( event ) local phase = event.phase local row = event.target if "release" == phase then --Update the item selected text itemSelected.text = "You selected item " .. row.index --Transition out the list, transition in the item selected text and the back button transition.to( tableView, { x = - tableView.contentWidth, time = 400, transition = easing.outExpo } ) transition.to( itemSelected, { x = 156, time = 400, transition = easing.outExpo } ) transition.to( backButton, { x = 156, time = 400, transition = easing.outQuad } ) end end -- Create a tableView tableView = widget.newTableView { top = 76, width = 312, height = 692, maskFile = "mask-312x692.png", listener = tableViewListener, hideBackground = true, noLines = true, onRowRender = onRowRender, onRowUpdate = onRowUpdate, onRowTouch = onRowTouch, } -- Create 100 rows for i=1, #pulledCategories do local isCategory = false local rowHeight = 50 local rowColor = { default = { 51, 51, 51 }, over = { 30, 144, 255 }, } local lineColor = { 220, 220, 220 } -- Insert the row into the tableView tableView:insertRow { isCategory = isCategory, rowHeight = rowHeight, rowColor = rowColor, lineColor = lineColor, } end
I hope this helps. The correct number of rows appear in the tableView, but the most recent value appears multiple times. I’ve attached a picture of what it looks like.
Thank you