Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15015] Android: TableView.headerView cannot be set after setting data

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-11-17T14:30:43.000+0000
Affected Version/sRelease 3.1.2, Release 3.2.0, Release 9.3.0
Fix Version/s2014 Sprint 02, 2014 Sprint 02 API, Release 9.3.0
ComponentsAndroid
Labelsandroid, headerview, qe-closed-3.3.0, qe-testadded, tableview, triage
ReporterFokke Zandbergen
AssigneeSunila
Created2013-08-16T06:57:55.000+0000
Updated2020-11-17T14:30:48.000+0000

Description

In the following example, the headerView doesn't show:
var w = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

var t = Ti.UI.createTableView();
var d = [];

for (var i = 0; i < 25; i++) {
    d.push(Ti.UI.createTableViewRow({
        title: 'Row ' + i
    }));
}

t.setData(d);
t.headerView = Ti.UI.createView({
    width: Ti.UI.FILL,
    height: 50,
    backgroundColor: 'red'
});

w.add(t);
w.open();
But if you set the headerView before calling setData it *does*.

Comments

  1. Daniel Sefton 2013-08-30

    Tested and confirmed on Samsung Galaxy S2 Android 2.3.6 with Ti SDK 3.1.2 GA and 3.2 CI.
  2. Sunila 2013-12-15

    Added support for setting headerView and footerView after setData. https://github.com/appcelerator/titanium_mobile/pull/5122
  3. Hieu Pham 2014-02-05

    Additional test case:
       var w = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
        
       var t = Ti.UI.createTableView();
       var d = [];
        
       for (var i = 0; i < 25; i++) {
           d.push(Ti.UI.createTableViewRow({
               title: 'Row ' + i
           }));
       }
        
       t.setData(d);
       t.setHeaderView(Ti.UI.createView({
           width: Ti.UI.FILL,
           height: 50,
           backgroundColor: 'red'
       }));
       
       t.footerView = Ti.UI.createView({
           width: Ti.UI.FILL,
           height: 50,
           backgroundColor: 'red'
       });
        
       w.add(t);
       w.open();
       
  4. Paras Mishra 2014-06-20

    TableView.headerView is getting set after setting data in TableView Verified the fix on : Tested on: Device: LG-P970, Android version: 4.0.4 SDK: 3.3.0.v20140619164112 CLI version : 3.3.0-rc OS : MAC OSX 10.9.2 Alloy: 1.4.0-rc ACS: 1.0.14 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201406171619 titanium-code-processor: 1.1.1 XCode : 5.1.1
  5. Samir Mohammed 2020-11-12

    As of the https://github.com/appcelerator/titanium_mobile/pull/12029 I am unable to see any of the rows just the header and footer
  6. Samir Mohammed 2020-11-17

    Closing ticket it as this is an unrelated issue, will be fixed in: https://github.com/appcelerator/titanium_mobile/pull/12029

JSON Source