Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15342] Android: Value of Label not getting updated in tableView when Table height is set as Ti.UI.SIZE

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionDuplicate
Resolution Date2013-11-26T23:05:04.000+0000
Affected Version/sRelease 3.1.4
Fix Version/sn/a
ComponentsAndroid
Labelsqe-3.1.4
ReporterPriya Agarwal
AssigneeHieu Pham
Created2013-09-25T11:19:44.000+0000
Updated2017-03-29T22:06:43.000+0000

Description

This is not a regression. Value of Label is not getting updated in tableView when Table's height is set as Ti.UI.SIZE.
var _window=Ti.UI.createWindow({backgroundColor:'white'});
var row = Ti.UI.createTableViewRow({
        width: 300,
        height: 40
    });    
 
     nameLabel = Titanium.UI.createLabel({
        text: 'Value',
        left: 10
    });
    row.add(nameLabel);
    
   valueLabel1 = Ti.UI.createLabel({
                text: 'New Label',
                right: 15,
                width: 'auto'
            });
    row.add(valueLabel1);
var tableView = Ti.UI.createTableView({
    backgroundColor: 'white',
    top: 0, width: 300,
    height: Ti.UI.SIZE,//it works fine if this line is commented.
    data: [row]
});
 
var addButton = Ti.UI.createButton({
    title: 'Update Label',
    width: 200, height: 100
});
 i=0;
addButton.addEventListener('click', function() {
 Ti.API.info('new value '+i);
  valueLabel1.text=i++;

});
 
_window.add(tableView);
_window.add(addButton);
_window.open();
 
Expected Result: On clicking the "Update Label" button value of Label "New Label" must be getting increment(changed) on every click. Actual Result: On iOS it works fine. On Android Value of label does not gets updated. but if "height: Ti.UI.SIZE" of tableview is commented off. Code works fine. Label's value gets updated.

Comments

  1. Ingo Muschenetz 2013-11-26

    Resolving as duplicate of linked issue. According to [~vduggal], this is actually a regression against SDK 3.1.1, but the behavior here _should_ be unsupported and is not recommended by Google. The workaround is not not use TI.UI.SIZE. The linked issue is being kept in the backlog. If you feel that the recommended workaround does not fit your needs, please comment on the attached ticket.
  2. Ivan Skugor 2013-11-27

    Sometimes we have to use "SIZE" - for example, if table view is added to scroll view which contains other UI elements beside table view. I managed to make a workaround by adding dummy first row with height 0. But that worked in my specific case and probably won't work for everyone since it has some side effects. IMHO, this issue is serious issue and it should be fixed.
  3. Abdiel Aviles 2015-12-15

    Why is this marked as Resolved? This is an obscure solution to a real problem.
  4. Lee Morris 2017-03-29

    Closing ticket as duplicate, please refer to TIMOB-15049.

JSON Source