Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1993] iOS: appendRow to a TableViewSection doesn't work

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2013-08-05T21:40:51.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsappendrow, tableviewrow, tableviewsection
ReporterMatej
AssigneeMauro Parra-Miranda
Created2013-08-05T19:45:01.000+0000
Updated2016-06-21T11:12:09.000+0000

Description

AppendRow/InsertRow... to a TableViewSection absolutely doesn't work! Tested it anyone before publication in the Ti Docs?
var win = Ti.UI.createWindow({
	backgroundColor: "white"
});

var table = Ti.UI.createTableView({
	width: Ti.UI.FILL, height: Ti.UI.FILL,
	style: Ti.UI.iPhone.TableViewStyle.GROUPED
});

var section_1 = Ti.UI.createTableViewSection();
var section_2 = Ti.UI.createTableViewSection();

section_1.add(Ti.UI.createTableViewRow({title: "ROW_1"}));
section_1.add(Ti.UI.createTableViewRow({title: "ROW_2"}));
section_1.add(Ti.UI.createTableViewRow({title: "ROW_3"}));

var addNextRow = Ti.UI.createTableViewRow({title: "Add next row"});

addNextRow.addEventListener("click", function(){
	section_2.appendRow(Ti.UI.createTableViewRow({title: "Added row..."}));
});

section_2.add(addNextRow);


table.data = [section_1, section_2];


win.add(table);
win.open();

Comments

  1. Daniel Sefton 2013-08-05

    As explained in TIDOC-622, you must use setData to create a new section layout. Workaround here: https://gist.github.com/iskugor/2775243 The appendRow method is available for the TableView class, not the TableViewSection class. See: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableView-method-appendRow
  2. Matej 2013-08-05

    Next workaround...nice https://gist.github.com/iskugor/2775243 -> This is about how to appendSection to a tableView not how to appendRow to a section. Why is in the Ti Docs this: ??Before the table is rendered, the TableViewSection add method may be used to add TableViewRow objects to a section. After it is rendered, one of the TableView insertRowBefore, insertRowAfter, or appendRow methods must be used instead.?? -> How to appendRow to a section using functions above...?
  3. Alberto Marcone 2016-06-21

    yep, I agree with the above comment

JSON Source