Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-516] table view does not render properly

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:53:21.000+0000
Affected Version/sn/a
Fix Version/sBacklog
ComponentsiOS
Labelsdefect, ios, iphone, tableview
ReporterNolan Wright
AssigneeJeff Haynie
Created2011-04-15T02:30:44.000+0000
Updated2011-04-17T01:53:21.000+0000

Description

from community - rows get cut off/jacked up
see ticket:
http://helpdesk.appcelerator.net/tickets/1398">http://helpdesk.appcelerator.net/tickets/1398

code:

var win = Titanium.UI.createWindow();
win.setBackgroundColor('#EAF6C4');
var e = Titanium.UI.createButton({

style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED,
systemButton:Titanium.UI.iPhone.SystemButton.REFRESH

}); win.setRightNavButton(e);
// var URL = "http://localhost/~neps/test.json"; // var URL = "http://gothamist.com/js/staticRecentEntries.json";">http://gothamist.com/js/staticRecentEntries.json"; var URL = "http://twitter.com/status/user_timeline/sxswist.json?count=30";">http://twitter.com/status/user_timeline/sxswist.json?count=30";

function fetchRows()
{
var data = [];
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
    // convert the response JSON text into a JavaScript object
    var entry = eval('(' + this.responseText + ')');

    for (var i=0;i<entry.length;i++)
    {
        var row = Ti.UI.createTableViewRow();
        row.height  ='auto';
        row.hasChild = true;
        row.className = 'normal'

        var comment = Ti.UI.createLabel({
        color:'#222',
        font:{fontSize:16,fontWeight:'normal', fontFamily:'Helvetica'},
        left:10,
        right:10,
        top:10,
        bottom:10,
        height:'auto',
        width:'auto', 
        text:entry[i].text
        });
        comment.rowNum = i;
        row.add(comment);

        var url = 'http://twitter.com/sxswist/status/' + entry[i].id;
        row.url = url; 

        data.push(row);
    }
    // hide loader
    toolActInd.hide();
    win.setToolbar(null,{animated:true});

    // since this is the first page, just set the data since we started out empty
    tableView.setData(data);
}
xhr.open("GET",URL);
xhr.send(null);
};

var tableView = Titanium.UI.createTableView();

var toolActInd = Titanium.UI.createActivityIndicator();
toolActInd.style = Titanium.UI.iPhone.ActivityIndicatorStyle.PLAIN;
toolActInd.font = {fontFamily:'Helvetica Neue', fontSize:15,fontWeight:'bold'};
toolActInd.color = 'white';
toolActInd.message = 'Loading...';
//loader start
win.setToolbar([toolActInd],{animated:true});
toolActInd.show();
//loader end

tableView.addEventListener('click', function(e)
{

    var rowdata = e.row;
    var w = Ti.UI.createWindow({title:'@sxswist',barColor:'#A2CF18'});
    var webview = Ti.UI.createWebView();
    webview.url = rowdata.url;
    webview.addEventListener('load',function(e)
    {
        Ti.API.debug("webview loaded: "+e.url);
    });
    w.add(webview);
    win.tab.open(w);
});

win.add(tableView); 
fetchRows();

e.addEventListener('click', function()
{
    //loader start
    win.setToolbar([toolActInd],{animated:true});
    toolActInd.show();
    //loader end
    tableView.setData([]);
    setTimeout(function()
    {
        fetchRows();
    },1000)
});

win.open();

Attachments

FileDateSize
516.tiff2011-04-15T02:30:44.000+0000265796
screen-shot-2010-08-26-at-113413-am.png2011-04-15T02:30:45.000+0000161372

Comments

  1. Thomas Huelbert 2011-04-15

    valid, needs test case.

    The issue is seen when scrolling the list, then revealing the previously scrolled objects. Occurs on simulator and device.

  2. Thomas Huelbert 2011-04-15

    added screenshot

  3. Steven Lu 2011-04-15

    What's the status of this ticket? This bug is a very big eyesore.

  4. Stephen Tramer 2011-04-15

    This ticket is still marked 'new' and is not marked as a priority bug for 1.5.0 currently. There has been no work done on it but we will fix it before release if there's time.

  5. Steven Lu 2011-04-15

    I still feel like this ticket should be at higher priority due to the number of watchers listed at the side. I noticed in 1.4.0rc1 that it was fixed momentarily, then after the 1.4.0 official push update, the bug came right back to haunt us.

  6. Stephen Tramer 2011-04-15

    Do you have any additional information about where this was fixed, and then broken again? There was a very wide gap between rc1 and the 1.4.0 drop.

  7. Russ Frank 2011-04-15

    Here's a test case:

    var win = Titanium.UI.currentWindow; var table = Ti.UI.createTableView(); data = []; for (var i=0; i < 40; i++) {

         var row = Ti.UI.createTableViewRow({layout:'vertical', height: 'auto'});
         var t = ""; 
         for (var j=0; j < i; j++) t += "test ";
         row.add (Ti.UI.createLabel({ height: 'auto', width: 'auto', text: t }));
         row.add (Ti.UI.createLabel({ height: 'auto', width: 'auto', text: t }));
         data.push(row);
       

    }
    table.setData(data); win.add(table);

    It appears that the bug will present when there are many vertical layout rows with height set to auto, each with multiple labels added to them with their heights set to auto, and when each row has a different height. Scrolling all the way to the bottom and back to the top with my test code above will reproduce the bug. See the attached screenshot of my simulator.

  8. Jesse Domack 2011-04-15

    This issue also pops up when you create a single label over 5 lines and attach it to a tableViewRow with AutoHeight. The label at first is terminated with '...' then when scrolled off the page and back, the rest of the text shows up but is drawn outside the tableview row.

  9. Stephen Tramer 2011-04-15

    Fixed as part of tableview/view refactoring, duplicate of... a billion other bugs.

JSON Source