Changing Text Color Of Row in a Table View

Hi

First of all this is my first project with Corona so sorry for any newbie error(NEWBIE BOARD! HURAYYY).

For my table view I wrote the below code:

[lua]

function onRowTouch( event )

if( event.phase == “ended”) then

for i = 1, hoursTable:getNumRows() do

hoursTable:getRowAtIndex( i ):setRowColor( {

default = {1, 0, 0},

over = { 0,1,0 }

})

end

 

event.target:setRowColor{

default = { 74/255, 74/255, 74/255, 1 },

over = { 74/255, 74/255, 74/255, 1 }

}

end

end

[/lua]

(This is the question part)What I was trying to do is to desellect all previously sellected rows and sellect the one touched. What it does is it only sets the color of touched row to red( which is my desellect color for testing) and wont touch other rows. Any idea to fix this problem is welcome.

Have Fun… 

Have you resolved this problem?  I’m having the same issue.

I would try doing a tableView:reloadData() call in your onRowTouch().  This will cause your onRowRender() function to get called for all visible rows.  If that function draws your default state, then when its done, you can then color the touched row the way you want it.

Rob

I endded up doing what someone suggested in another post.  I added a display.newRect into my row.background and manipulate the color thru that.

Have you resolved this problem?  I’m having the same issue.

I would try doing a tableView:reloadData() call in your onRowTouch().  This will cause your onRowRender() function to get called for all visible rows.  If that function draws your default state, then when its done, you can then color the touched row the way you want it.

Rob

I endded up doing what someone suggested in another post.  I added a display.newRect into my row.background and manipulate the color thru that.