Titanium Community Questions & Answer Archive

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

borderColor for TableViewRow not working

I tried the following to set the border color of a table row but it didn't work. What am I missing?

    var row = Titanium.UI.createTableViewRow({
        borderColor: "#436394",
        borderWidth: 5,
        backgroundColor: 'transparent'
    });
— asked December 17th 2010 by Danny Roa
  • ui
2 Comments
  • You have not stated your platform and Ti SDK version. :-/

    — commented December 17th 2010 by Paul Dowsett
  • Did we get an answer for this?

    — commented February 1st 2011 by Scott Millar

4 Answers

  • what you are looking for is the table property of separatorColor

    var tableView = Titanium.UI.createTableView({
        separatorColor:'#ccc',
        backgroundColor:'#fff'
    });
    
    — answered December 17th 2010 by Matt Apperson
    permalink
    0 Comments
  • Danny,

    You are not missing anything. Border Color and Border Width doenst work with table view rows. Dont assume the documentation is 100% because is far from it at this point. If you are trying to create a border you have several options:

    • Create a view and then position your elements inside the view. Then add the view to the table row.
    • Add elements to your table row with a left: 10 (for example)
    • Add a view to hold your tableview then use the view image as a background for your tableview.

    Hope that helps

    Cheers

    — answered December 17th 2010 by Daniel Ander
    permalink
    1 Comment
    • Thank you!! That worked for me just fine.

      var bar =  Titanium.UI.createImageView({
              image : "images/documents_rowSeparator.png",
              bottom: "-1,2dp",
              left : "0dp",
              width: "auto",
              height: "auto"
          });
      (...)
      row.add(bar);
      

      — commented December 27th 2011 by José Júnior
  • Another method you can use if you want to have no borders between blank rows but show a border between the rows that have content, add a view to the bottom of the TableViewRow that's 1 pixel wide (or whatever you prefer) and 100% of the width of the row.

    
    var row = Ti.UI.createTableViewRow({});
    
    var border = Ti.UI.createView({
        bottom: 0,
        width: '100%',
        height: 1,
        color: '#a6a6a6',
    });
    row.add(border);
    

    The only thing is that if you want to use a detail in the row (i.e., hasDetail: true), the end of the 'border' view will be truncated.

    — answered August 26th 2011 by Mark Pemburn
    permalink
    0 Comments
  • Now it is supported since 3.2

    http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.ListView-property-separatorColor

    just set it to transparent like:

    var listView = Ti.UI.createListView({
        separatorColor : "transparent"
    });
    
    — answered March 17th 2014 by gino ginetti
    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.