I have a TableView in a tablet app, so it only covers a small part of the screen and I keep it resident there. When a user selects a row, data for that row appears on the rest of the screen, and I would like to be able to highlight that row to remind the user of which row they’re on.
I’ve tried a lot of different ideas, but so far all I get is a highlighted row that persists when another row is pressed, instead of being set back to the unhighlighted color. Here’s my latest attempt:
local function onRowTouch( event ) local phase = event.phase if "press" == phase then for i=1,#list.\_view.\_rows do if (i == event.target.index) then -- Set highlight color list.\_view.\_rows[i].\_view:setRowColor( { default = {160,92,92,128 }} ) else -- Set unhighlight color list.\_view.\_rows[i].\_view:setRowColor( { default = {92,92,92,128 }} ) end list.\_view.\_rows[i].\_view.reRender = true end end return true end
If I push the tableview up off screen and let it pop back, then the rows change to the colors I set in onRowTouch, so it seems like there’s a way to trigger a rerender. That’s all I really need for the behavior I’m looking for. How can I do that?
edit: Also, what’s up with IE10 formatting? This code looks fine on Chrome, but I tried many different ways of formatting and it still looks like crap on IE10.