Alexander Blazso
Alexander Blazso

Reputation: 1

Appcelerator Titanium tableView

I have a problem with tableView, specifically when I use a valid url as data for leftImage.

It works like a charm if I use a local file, but not with any valid URL. Can anyone help me with this and tell me what I am doing wrong, and how it could be fixed so that I can display a jpg from a remote server?

P.S. Below is the related Titanium code. I am using Titanium Mobile 1.7.2 in Titanium Studio

 //...
    var thisRow = Ti.UI.createTableViewRow({
    leftImage: "images/pix_sd_1.jpg",       // This works!
    leftImage: "http://terminalentry.dyndns.org/~alex/pix/pix_sd_1.jpg",   // this does not work!

    layout:"vertical",
    objectName:"RentalRow",
    selectedColor:"black",
    height:60
    });
    thisRow.add(thisLabelCity);
    thisRow.add(thisLabelState);
    thisRow.add(thisLabelRentals);
    thisRow.add(thisLabelTemp);
    tableData.push(thisRow);
  
    labelTempArray.push(thisLabelTemp);
    //...

Upvotes: 0

Views: 716

Answers (2)

mkind
mkind

Reputation: 2043

i have no idea if remote images in leftimage properties are valid but you could do it like

ti.ui.createTableViewRowWithLeftImage = function(_args){
  var leftImage = Ti.UI.createImage({
    left:4,
    top:4,
    height:20,
    width:20,
    url: _args.leftImage
  });

  var row = Ti.UI.createTableViewRow();
  row.add(leftImage); 
  return row;
}    ;

var myRow = ti.ui.createTableViewRowWithLeftImage({
  leftImage:http://terminalentry.dyndns.org/~alex/pix/pix_sd_1.jpg
});

Upvotes: 0

Aaron Saunders
Aaron Saunders

Reputation: 33345

I think that you might need to encode that URL, this character "~" might be causing some problems

Upvotes: 0

Related Questions