[TIMOB-26887] Android: TableView "headerTitle" and "footerTitle" cannot be changed after creation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | Release 9.3.0 |
Components | Android |
Labels | TableView, android, engSchedule, header, parity |
Reporter | Joshua Quick |
Assignee | Gary Mathews |
Created | 2019-03-08T03:37:02.000+0000 |
Updated | 2020-11-20T00:24:30.000+0000 |
Description
*Summary:*
The
Ti.UI.TableView
properties "headerTitle" and "footerTitle" can only be set via creation properties on Android. They cannot be changed dynamically afterwards.
iOS supports changing the title dynamically. And our documentation states that they can be changed on all platforms as well. Android should be changed to match iOS' behavior.
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-property-headerTitle
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView-property-footerTitle
*Steps to reproduce:*
Build and run the below code on Android.
Watch the header and footer text in the table view.
Notice header/footer never changes. (Below code will update them every 2 seconds.)
var rows = [];
for (var index = 1; index <= 5; index++) {
rows.push(Ti.UI.createTableViewRow({ title: "Row " + index }));
}
var window = Ti.UI.createWindow({
fullscreen: Ti.App.iOS ? true : false,
});
var tableView = Ti.UI.createTableView({
headerTitle: "Header",
data: rows,
footerTitle: "Footer",
width: Ti.UI.FILL,
height: Ti.UI.FILL,
});
tableView.headerTitle = "Header (Updated)";
tableView.footerTitle = "Footer (Updated)";
window.add(tableView);
window.open();
var updateCount = 0;
setInterval(function() {
updateCount++;
tableView.headerTitle = "Header (" + updateCount + ")";
tableView.footerTitle = "Footer (" + updateCount + ")";
}, 2000);
*Work-Around:*
Use the "headerView" and "footerView" instead.
master: https://github.com/appcelerator/titanium_mobile/pull/12029