Problems with TableView

I’m testing some code that creates a TableView where each row have a background image and a text. I’m encountering a problem where it seems the row render seems to be skipping one row and it goes crazy when I scroll. Haven’t test it on the device yet but here’s a video of what’s happening: http://screencast.com/t/jhkgylrYxzx. Here’s the code for the table:

 local onRowRender = function(e) local row = e.row local rowBg = display.newImage("assets/images/recipes\_list\_item.png") rowBg.x = row.x rowBg.y = row.y row:insert(rowBg) local rowText = display.newText({ parent = row, text = "Ejemplo", font = "HelveticaNeueLTStd-BdCn", fontSize = 40, y = row.y }) rowText:setReferencePoint(display.CenterLeftReferencePoint) rowText:setTextColor(0, 43, 92) rowText.x = 275 row:insert(rowText) end local onRowTouch = function(e) if (e.phase == "release") then end end local tableView = widget.newTableView({ top = 116, left = 0, width = 640, height = 725, maskFile = "assets/images/list\_mask.png", hideBackground = true, onRowRender = onRowRender, onRowTouch = onRowTouch }) for i = 1, 100 do tableView:insertRow({ rowHeight = 180, rowColor = { default = {255, 255, 255, 0}, over = {255, 255, 255, 0} }, lineColor = {255, 255, 255, 0} }) end

I believe you’re setting a few coords, er, unusually…

Try setting y only where you set the x (for both objects), and set it to: y = row.height / 2, and set  x = row.width/2…

Yep, I figured it out. I find it a bit unusual that when put something in the row group it’s coordinates become relative to the row instead of the screen. It’s not in the documentation either.

Each row is basically a corona display.group object, so things inserted into it become relative to the row as it scrolls around.  Anyways, glad you sorted it out, best wishes.

I believe you’re setting a few coords, er, unusually…

Try setting y only where you set the x (for both objects), and set it to: y = row.height / 2, and set  x = row.width/2…

Yep, I figured it out. I find it a bit unusual that when put something in the row group it’s coordinates become relative to the row instead of the screen. It’s not in the documentation either.

Each row is basically a corona display.group object, so things inserted into it become relative to the row as it scrolls around.  Anyways, glad you sorted it out, best wishes.