Titanium Community Questions & Answer Archive

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

Autoheight Label

I have created a table where the text changes when clicked but if I have a really long sentence like below, it automatically adds an ellipses and I can't figure out where to put the autoheight text code to make it work. The code I am using is below

var win = Titanium.UI.currentWindow;

// create table view data
var data = [
{title:'This is the longest possible title you can do', title1: 'This is the longest possible title you can do', title2: 'Text Changing'},
];

var search = Titanium.UI.createSearchBar({
   showCancel:false
});

var tableView = Titanium.UI.createTableView({data:data, search:search, filterAttribute:'title'});
tableView.addEventListener('click',function(e){
    if(e.rowData.title == e.rowData.title1)    {
        e.row.title = e.rowData.title2;

   } else if(e.rowData.title == e.rowData.title2)    {        
        e.row.title = e.rowData.title1;
    }
});

win.add(tableView);
— asked October 21st 2010 by J W
  • autoheight
  • data
  • iphone
  • tableview
0 Comments

1 Answer

  • I also had some problems with autohight and figured that it works best to just remove the label and create a new one with the new text. Works for me.

    — answered October 22nd 2010 by Peter Griffin
    permalink
    1 Comment
    • This is what i've been stuck doing too.. Hardly best practice. Would love some info on a workaround.

      — commented November 8th 2010 by Glen McPherson
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.