Titanium Community Questions & Answer Archive

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

Do table views require each row have the same content elements?

Code that works for a small number of rows (<8) with different numbers of icons (image views) blows an exception when the table's larger (9+). Initial display is correct. Scrolling crashes app.

I recreated the crash in Kitchen Sink 1.0, Table View Layout 2 (iPhone SDK 3.1.3, Ti Dev 1.0/SDK 1.0.0) removing alternating "photos" (image views).

table_view_layout_2.js (line 97):

  if (c%2) row.add(photo);
— asked March 17th 2010 by Brad Broulik
  • iphone

1 Answer

  • Accepted Answer

    Nope :)

    When tableView rows have different layout, you MUST give them a different 'className' or it will crash when scrolling.

    You'll see the KS code that each row is set to the className, 'datarow'

    So, to use your example test, simply use this instead:

            row.className = 'image_datarow';

    (you also wouldn't need the imageView or its click listener in your example too ;) )

    hope this helps,

    — answered March 17th 2010 by Kosso
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.