Titanium Community Questions & Answer Archive

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

TableView Rows Add Labels

Hi All,

I was just wondering if I could add label inside a row directly? This would be very helpful to me as i would then be able to set rows using a webservice which would be way quicker than it is at the moment.
Although everything seems good to me with appcelerator, speed of accessing webservice and then manipulating data is a bit slow (not acceptable) so I am trying everything possible to download content
quicker.

Something like

var myRow = Titanium.UI.createTableViewRow({label:{text:'Hello World',
 textAlign:'center', left:5}, label:{text:'Right' right:5}});

Any help inregards to this would be appreciated.

— asked May 2nd 2010 by sanchit sharma
  • android
  • tableviewrow
0 Comments

3 Answers

  • It is slow when creating the rows or when accessing the web service?
    If it's slow when creating the rows, have you added a className to the rows?
    Also don't try to add too many rows in a single shot.

    — answered May 3rd 2010 by Dan Tamas
    permalink
    1 Comment
    • I'm having the same issue with this, and the slow performance is when the labels are added to the rows… I believe I've added class names as your tutorial suggested, yet still experience this, even when adding the tableview to the page is delayed by a few seconds.

      — commented March 15th 2011 by Scott Millar
  • HI Tamas,

    It's the binding of the rows that is slow. As some of my rows contain multiple labels, i have to manually add those labels to the rows like

    row.add(label1);
    row.add(label2);
    

    The webservice is a powerful asp.net service that is cached so that shouldn't be a problem. What is the advantage of adding className? should the className be unique for each row or should it be the same for all rows?

    Thanks a lot for your help…

    — answered May 3rd 2010 by sanchit sharma
    permalink
    0 Comments
  • Adding a className to the similar rows tells the rendering engine inside the iphone to use the same template for this rows. This will improve a lot the performance.
    If you don't do this, it will allocate memory for each row as a new different row, and in the end will move slow or even crash.

    A good practice would be to add a limited number of rows - even apple does this - and let the user choose to add more.

    Also keep in mind that not the response of the server is the one that needs time, but to transfer the data. If you use less data, will be faster.
    If you have images in your replay send the right image at the exact size not (bigger) and even optimized - I use ImageOptim for this.

    — answered May 4th 2010 by Dan Tamas
    permalink
    0 Comments
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.