Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-2708

Android: Setting heights on TableView rows with classNames after creation no longer works

    Details

      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();
      

        Attachments

          Activity

            People

            • Assignee:
              mpmiranda Mauro Parra-Miranda
              Reporter:
              jtoth Justin Toth
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Integration