Titanium Community Questions & Answer Archive

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

Is there a way to target the rows created by "createTableView"

I would like to append an image to the rows already created by the above method but I cannot target the rows. Is there a workaround to do that or should I create the rows one by one to be able to target them?

— asked March 18th 2010 by michel perrin
  • rows
  • tableview
  • target

3 Answers

  • Accepted Answer

    I'll post an example on updating some text.


    • tableView = Titanium.UI.createTableView
    • data[x] = the default section being "0" (zero)
    • rows[i] = the row you are "targeting"
    • children[z] = the element in the order you appended to the row.

    tableView.data[x].rows[y].children[z].text = "hello!"

    — answered May 18th 2010 by Caio Iglesias
    1 Comment
    • I am using a table with sections. This works fine for the first section. But if I try to access rows in the second section it fails. The index is not correct. For example if I set tableView.data[0].rows[1].children[1].text = "hello!" it works fine but if I target the second section with tableView.data[1].rows[5].children[1].text = "hello!" it fails. The index number of the row is 5 and it does not work BUT if I set 1 instead it works. How can I access the row index within a section instead of the whole table?

      — commented July 7th 2011 by James -
  • when you say "target" rows do you mean how do you get access to a row object?

    the table view has a sections array which in turn has a rows array. to access a row object, you just need to get to the row you want within the rows array.

    all table views have at least 1 section by default if you don't create one.

    — answered March 18th 2010 by Nolan Wright
  • Thanks Nolan, I'll work on that this week end. As a former Flash developper I still have trouble to figure out the object hierarchy inside Titanium

    — answered March 18th 2010 by michel perrin
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.