[AC-2708] Android: Setting heights on TableView rows with classNames after creation no longer works
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-07-03T18:08:58.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | android, classname, height, regression, tableviewrow |
Reporter | Justin Toth |
Assignee | Mauro Parra-Miranda |
Created | 2013-07-01T18:13:51.000+0000 |
Updated | 2016-03-08T07:41:49.000+0000 |
Description
*Problem*
Setting the height of TableView rows with classNames after creation no longer works in Android.
*Expected behavior*
Pressing row 1 would toggle showing and hiding row 2. Pressing row 3 would toggle showing and hiding row 4.
*Actual behavior*
Pressing row 1 or 3 does nothing, rows 2 and 4 stay hidden.
*Note*
This is a regression in Titanium 3.1.1.GA, the same code works correctly in Titanium 3.1.0.GA. Removing the classNames from the rows isn't a workaround, as it will cause out of memory crashes on long tables. Using visible/show/hide to show and hide the rows instead of height isn't a workaround either, as this has never worked on Android.
*Test case*
var win = Ti.UI.createWindow({
backgroundColor : "#fff"
});
var table = Ti.UI.createTableView({
top : 0,
bottom : 0,
left : 0,
right : 0
});
var rows = [];
var firstRow = Ti.UI.createTableViewRow({
height : '60dp',
backgroundColor : 'Red',
className : 'rowType1'
});
firstRow.add(Ti.UI.createLabel({
text : 'Row 1'
}));
firstRow.addEventListener('click', function() {
secondRow.height = (secondRow.height === 0 ? '60dp' : 0);
});
rows.push(firstRow);
var secondRow = Ti.UI.createTableViewRow({
height : 0,
backgroundColor : 'Gray',
className : 'rowType2'
});
secondRow.add(Ti.UI.createLabel({
text : 'Row 2'
}));
rows.push(secondRow);
var thirdRow = Ti.UI.createTableViewRow({
height : '60dp',
backgroundColor : 'Red',
className : 'rowType1'
});
thirdRow.add(Ti.UI.createLabel({
text : 'Row 3'
}));
thirdRow.addEventListener('click', function() {
fourthRow.height = (fourthRow.height === 0 ? '60dp' : 0);
});
rows.push(thirdRow);
var fourthRow = Ti.UI.createTableViewRow({
height : 0,
backgroundColor : 'Gray',
className : 'rowType2'
});
fourthRow.add(Ti.UI.createLabel({
text : 'Row 4'
}));
rows.push(fourthRow);
table.setData(rows);
win.add(table);
win.open();
I tested this on a Samsung Galaxy S2 Android 2.3.6; actually the opposite occurs to what you describe: The rows show/hide correctly on 3.1.1 GA, but not on 3.1 GA.
Fixed in 3.1.3