Titanium Community Questions & Answer Archive

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

Bug: Rendering problem - TableView w/ TableSection & custom HeaderView

I saw issue about TableView + TableSection & custom headerview :

  • here http://developer.appcelerator.com/question/77001/bug-tableview-with-header-and-section-not-working-correctly
  • and here https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2282

But this is not the issue I am encountering. My problem is linked to rendering.

Here a snippet. If you comment the line :

tableSection.headerView = customHeader;

Then the rendering behavior is back to normal.

Is this a known bug ? A regression or me making bad usage of the APIs ? (kinda new to Titanium so we never know…).


function createCustomTableSection() {
    var tableSection = Titanium.UI.createTableViewSection({
        headerTitle: 'Monday 05 July 2010'
    });

    var customHeader = Titanium.UI.createView({
        height: 45,
        backgroundImage: 'table_section_bg.png'
    });
    var dateLabel = Titanium.UI.createLabel({
        text:'Monday 05 July 2010',
        color:'#b4d0ee',
        top: 5,
        left: 5
    });
    customHeader.add(dateLabel);
    tableSection.headerView = customHeader;

    tableSection.add(Titanium.UI.createTableViewRow({title:'Monday 05 July 2010'}));
    tableSection.add(Titanium.UI.createTableViewRow({title:'Tuesday 06 July 2010'}));
    tableSection.add(Titanium.UI.createTableViewRow({title:'Wednesday 07 July 2010'}));
    tableSection.add(Titanium.UI.createTableViewRow({title:'Thursday 08 July 2010'}));
    return tableSection;
}


Titanium.UI.setBackgroundColor('#000');

var win = Titanium.UI.createWindow();

// Create header
var header = Titanium.UI.createView({
    backgroundImage: 'home_header.png',
    top: 0,
    height: 43
});

var l = Titanium.UI.createLabel({
    text: 'Plenary sessions',
    color: 'white',
    font:{fontSize: 18},
    height: 'auto',
    right: 'auto',
    top: 5,
    left: 10,
    width: 150
});

header.add(l);
win.add(header);

var sections = [];
for (var i = 0; i < 8; i++) {
    sections[i] = createCustomTableSection();
}

var tableView = Titanium.UI.createTableView();
tableView.setData(sections);

win.add(tableView);
win.open();
— asked December 7th 2010 by Jeremy Rousset
  • headerview
  • tableview
  • tableviewsection
0 Comments

2 Answers

  • No ones can confirm the issue or indicates if I'm doing something wrong ? :o

    — answered December 8th 2010 by Jeremy Rousset
    permalink
    0 Comments
  • For information: I tried to run my program with the latest build from http://builds.appcelerator.com.s3.amazonaws.com/index.html.

    Nov 16 2010 12:06 r490583c4 : partially fixes the problem. Section header are correctly on top, but not their background (still shift with the rest of the table content)

    Nov 21 2010 15:02 rb47ae8fc : works as expected.

    Nice work about this great product … however a comment to indicates to try CI / bug fixed could have been nice.

    — answered December 9th 2010 by Jeremy Rousset
    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.