Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9640] Android: 'postlayout' event is not triggered

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-11T04:22:29.000+0000
Affected Version/sRelease 2.1.0, Release 2.0.1
Fix Version/sSprint 2012-13 Core, Release 3.0.0
ComponentsAndroid
Labelscore, module_tableview, parity, qe-review, qe-testadded
ReporterFederico Casali
AssigneeMax Stepanov
Created2012-06-19T13:26:39.000+0000
Updated2013-12-10T06:12:05.000+0000

Description

Problem description

'postlayout' event is not fired on Android

Sample code to reproduce

Run the sample code below. 'postlayout' event it's not fired only on Android OS. iOS works fine.
var win = Ti.UI.createWindow({
	backgroundColor:'white',
	title:'test',
	modal:true
});

var data1 = [];

var tvr = Ti.UI.createTableViewRow({
	title:'pippo',
	hasChild:true
});
data1.push(tvr);

var table = Ti.UI.createTableView({
	top: 10,
	left: 10,
	width: 200, 
	height: 200,
	scrollable: false,
	borderRadius: 10,
	backgroundColor: 'white',
	data : data1
});
table.addEventListener('postlayout', function() {
	setTimeout(function(){
		Ti.API.info('#### postlayout table event received.');
		alert('postlayout table event fired');
	},600);
});
win.add(table);


win.open();

Comments

  1. Max Stepanov 2012-06-25

    PR pending https://github.com/appcelerator/titanium_mobile/pull/2467
  2. Ivan Skugor 2012-06-26

    Still doesn't work as expected for window. Before, "postlayout" event wasn't fired, now it's being fired twice. Here is my test case:
       var win = Ti.UI.createWindow({
       	backgroundColor: '#ccc'
       });
       
       var table = Ti.UI.createTableView();
       
       win.add(table);
       
       var data = [];
       for(var i = 0; i < 500; i++){
       	data.push({ title:'Row #'+i });
       }
       table.setData(data);
       
       win.addEventListener('postlayout', function() {
       	Ti.API.info('Postlayout event fired!');
       });
       
       win.open();
       
    Tested on Android 3.1 device with latest CI build.
  3. Max Stepanov 2012-06-26

    Ivan, the behavior you describe is unrelated to this ticket. I tested your example before (which is current master) and after (after applying PR 2467), it behaves identically by double firing postlayout. Please create a separate JIRA.
  4. Ivan Skugor 2012-06-27

  5. Tamila Smolich 2012-08-27

    Closing as fixed. Tested and verified on: Titanium Studio, build: 2.1.2.201208201549 Titanium SDK, build: 2.2.0.v20120824175712 Devices: Nexus S (4.1.1), HTC Evo (4.0.3)
  6. Neha Chhabra 2012-09-11

    Reopening to update labels
  7. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5003

JSON Source