Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2395] Android: in tableview, "sections" property (SDK >= 3.0.0) not working like "data" (SDK < 3.0.0)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2013-02-02T01:55:46.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandoid, api, property, sdk3, section, tableView
ReporterMarco Seguri
AssigneeEduardo Gomez
Created2013-01-17T09:24:01.000+0000
Updated2016-03-08T07:41:25.000+0000

Description

Problem

sections property in TableView does not work as expected. Still needed to use data property.

Test case

Example code provided in docs: [Table View Sections](http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.TableView)
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();
 
var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' });
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' }));
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' }));
 
var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
 
var table = Ti.UI.createTableView({
  // Prior to Release 3.0, add sections using the data property:
  // data: [sectionFruit, sectionVeg]
  sections: [sectionFruit, sectionVeg] // BUG
});
 
win.add(table);
win.open();

Comments

  1. Marco Seguri 2013-01-17

    Why was this issue opened in TC? I wanted TIMOB, sorry
  2. Eduardo Gomez 2013-02-02

    Hello Marco, We can't accept incomplete community reports. Please provide a working sample to replicate what you are seeing. You may want to have a look at [Jira checklist](http://docs.appcelerator.com/titanium/latest/#!/guide/How_to_Submit_a_Bug_Report-section-29004732_HowtoSubmitaBugReport-JIRATicketChecklist). I'd reopen when resources are available.
  3. Marco Seguri 2013-02-02

    Resources are already available. I already described what to do. Open a new mobile project and copy and paste the sample from appcelerator's docs. Anyway, this is the code. app.js:
       Ti.UI.backgroundColor = 'white';
       var win = Ti.UI.createWindow();
       
       var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' });
       sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' }));
       sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' }));
       
       var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
       sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
       sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
       
       var table = Ti.UI.createTableView({
         // Prior to Release 3.0, add sections using the data property:
         // data: [sectionFruit, sectionVeg]
         sections: [sectionFruit, sectionVeg] // BUG
       });
       
       win.add(table);
       win.open();
       
  4. Marco Seguri 2013-02-26

  5. Eduardo Gomez 2013-02-26

  6. Shak Hossain 2014-01-01

JSON Source