Table View 'click' event - offscreen oddity
Hey all.
I am working on my first Ti app and LOVE this framework for development. I have a weird thing happening that I wanted to share. Its not a huge issue but its still worth sharing.
I have a table view that when clicked has checks that appear on the right using .hasCheck
I use the following code to toggle the check and text color:
setTimeout(function()
{
if(section.rows[secRow].hasCheck) {
section.rows[secRow].hasCheck = false;
section.rows[secRow].children[0].color = '#000';
} else {
section.rows[secRow].hasCheck = true;
section.rows[secRow].children[0].color = '#336699';
}
},250);
This works great on the phone. Except for one issue. the table runs longer than the screen so some rows are off stage. If I toggle some checks on and off and then scroll down or up to any offscreen rows, there are some rows whos text color has changed to #336699 when it wasn't even touched (since it was off screen). Clicking that row keeps the text 336699, the check appears. Clicking again the text changes back to 000000 and the check disappears.
So offscreen rows are changing text color when they shouldnt be. Has anyone heard of this happening? Any way to resolve it?
Thanks
Fish
1 Answer
-
have you made sure that each row has a unique 'className' property?
that might be the cause.