Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9905] Android: Tableview not updated when a new view is added to a tableviewrow

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-06-19T11:13:26.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-16 API, Release 3.0.0
ComponentsAndroid
Labelsapi, module_tableview, qe-testadded
ReporterAnirudh Nagesh
AssigneeHieu Pham
Created2012-07-06T15:46:32.000+0000
Updated2013-06-19T11:13:26.000+0000

Description

Tableview does not get updated when a new view ( label, text area) is added to the tableviewrow. Works fine on iOS. 1. Run the code below in app.js
var _window = Ti.UI.createWindow({
	
	backgroundColor:'#fff'
});

	row = Ti.UI.createTableViewRow({
		width: 300,
		height: 40
	});
	

	nameLabel = Titanium.UI.createLabel({
		text: 'Title',
		left: 10
	});

	row.add(nameLabel);
	


tableView = Ti.UI.createTableView({
	backgroundColor: 'white',
	top: 0, width: 300,
	height: Ti.UI.SIZE,
	data: [row]
});

addButton = Ti.UI.createButton({
	title: 'Add Label',
	width: 200, height: 100
});


addButton.addEventListener('click', function() {
	
	
	valueLabel1 = Ti.UI.createLabel({
				text: 'New Label',
				right: 15,
				width: 'auto'
			});
	row.add(valueLabel1);
	Ti.API.info('self contents....'+row.children[1].text);

});

_window.add(tableView);
_window.add(addButton);

_window.open();
On iOS, new label gets added to the tableview row. On Android, label gets added to the tableview row ( info statement seen in ddms) but view not updated. Workaround: Use setData() to reset the tableview rows. ( works fine on both iOS and Android)

Comments

  1. Ivan Skugor 2012-07-09

    There are similar situations where update of table view doesn't trigger re-layout cycle automatically (like adding table view sections after table view is rendered), therefore developer has to do it programmatically (via setting same data: table.setData(table.data) ). It would be nice if developer wouldn't need to trigger re-layout programmatically.
  2. Cindy Kao 2012-08-02

    Client has come back and asked for this to take high priority as they are looking to submit their app to the App Store by 8/10. If you can come up with a work-around, we are also open to that as a solution.
  3. Vishal Duggal 2012-08-08

    Fixed by https://github.com/appcelerator/titanium_mobile/pull/2691
  4. Rima Umbrasas 2012-08-10

    Verified fixed with mobile sdk-2.2.0.v20120810080115 Titanium Studio, build: 2.1.1.201207271312 Galaxy S III Android version 4.0.4
  5. Priya Agarwal 2013-06-19

    Opened just to update the label
  6. Priya Agarwal 2013-06-19

    Label updated and verified Tested on: Device: Google Nexus Android Version 4.0.4, SDK:3.1.2.v20130617140100 Appcelerator Studio: 3.1.1.201306131423 OS: OSX 10.8 acs:1.0.3 alloy:1.1.3-cr npm:1.2.14 titanium:3.1.1-cr titanium-code-processor:1.0.1-cr5

JSON Source