Is it possible to animate objects inside a tableview row?

Hello, I have a tableview and I’d like to fade in an element when the user has decided to delete one of the rows.  I can transition to the whole row, but how can I fade in a graphic that is in that row?  Here is what I have tried so far…

local function onRowRender( event )     local row = event.row     local rowHeight = row.contentHeight     local rowWidth = row.contentWidth local whichOne = BookmarksTable[row.index][1]     local rowTitle = display.newText( row, buttonColors[BookmarksTable[row.index][1]][4] , 0, 0, "Univers-Light", 24 )     rowTitle:setFillColor( 0 )     rowTitle.anchorX = 0     rowTitle.x = 100     rowTitle.y = rowHeight \* 0.3     local delImage = display.newImage(row, "assets/delete\_gradient.png", true)     delImage.anchorX, delImage.anchorY = 0, 0     delImage.x = 100     delImage.y = 0     delImage.alpha = 0.5 end  

local function onRowTouch( event )      local row = event.target      if event.phase == "press" then      elseif event.phase == "swipeLeft" then          print( "Swiped left." )          delRow = event.target          if (delRow.id == nil) then              print("swiped empty area")        else           transition.to( delRow, { time = 250, x = -50 } )            transition.to( delRow.delImage, { time = 250, alpha = 1.0 } )           local alert = native.showAlert( "Bookmark", "Delete bookmark?", { "No", "Yes" }, onDELComplete )          end         elseif event.phase == "swipeRight" then           print( "Swiped right." )         elseif event.phase == "tap" then         print( "Tapped." )         end         return true end  

The second transitionto “transition.to( delRow.delImage,…” is what isn’t giving an error or working.

Any ideas where I went wrong, or how to do it correctly?  

Thanks!

I found a workaround.  In the row I rendered everything twice, one set offset to the right of the screen where it’s not seen, than instead of animating something withing the row, I animate the whole row to shift over to reveal the second set.

transition.to( delRow, { time = 1, x = -640 } )

From the users point of view, something new pops up with the rest of the row.  A workaround, but working :slight_smile:

You can do something like this:

local function onRowRender( event )     local row = event.row     local rowHeight = row.contentHeight     local rowWidth = row.contentWidth local whichOne = BookmarksTable[row.index][1]     row.rowTitle = display.newText( row, buttonColors[BookmarksTable[row.index][1]][4] , 0, 0, "Univers-Light", 24 )     rowTitle:setFillColor( 0 )     rowTitle.anchorX = 0     rowTitle.x = 100     rowTitle.y = rowHeight \* 0.3     row.delImage = display.newImage(row, "assets/delete\_gradient.png", true)     delImage.anchorX, delImage.anchorY = 0, 0     delImage.x = 100     delImage.y = 0     delImage.alpha = 0.5 end

By adding your row objects to the row itself, you can then reference them in your onRowTouch function.

Rob

Thanks!  That works well.

I found a workaround.  In the row I rendered everything twice, one set offset to the right of the screen where it’s not seen, than instead of animating something withing the row, I animate the whole row to shift over to reveal the second set.

transition.to( delRow, { time = 1, x = -640 } )

From the users point of view, something new pops up with the rest of the row.  A workaround, but working :slight_smile:

You can do something like this:

local function onRowRender( event )     local row = event.row     local rowHeight = row.contentHeight     local rowWidth = row.contentWidth local whichOne = BookmarksTable[row.index][1]     row.rowTitle = display.newText( row, buttonColors[BookmarksTable[row.index][1]][4] , 0, 0, "Univers-Light", 24 )     rowTitle:setFillColor( 0 )     rowTitle.anchorX = 0     rowTitle.x = 100     rowTitle.y = rowHeight \* 0.3     row.delImage = display.newImage(row, "assets/delete\_gradient.png", true)     delImage.anchorX, delImage.anchorY = 0, 0     delImage.x = 100     delImage.y = 0     delImage.alpha = 0.5 end

By adding your row objects to the row itself, you can then reference them in your onRowTouch function.

Rob

Thanks!  That works well.