Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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

— asked September 16th 2010 by Dave F
  • hascheck
  • iphone
  • row
0 Comments

1 Answer

  • have you made sure that each row has a unique 'className' property?

    that might be the cause.

    — answered September 16th 2010 by Kosso
    permalink
    1 Comment
    • Hey thanks for the reply. Does each row need a different className? I thought if the rows have similar layout and functionality the className should be the same.

      — commented September 16th 2010 by Dave F
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.