Terran Brown
Terran Brown

Reputation: 529

Titanium Alloy Custom Row Problems

Problem:

App - web based

I have been referring to http://cssgallery.info/custom-row-for-tableview-in-appcelerator-titanium/ on how to create a custom row

My app collects json from a server and parses through it line by line. It then pushes each line in to an array and finally out to the view.

How ever no matter how I do this the view seems to be missing see attached image.

It seems only DISTANCE is processed how ever if you look at the source of the created page the data seems to be parsing through but not displayed

Image of The Problem

for (var i = 0; i < parseddata.jsonp.length; i++) {

            var lastRow = i, c = lastRow + 30;
            lastRow < c;
            lastRow++;

            var VAIRABLE2 = parseddata.VAIRABLE2[i];
                            var VAIRABLE3 = parseddata.VAIRABLE3[i];
            var DISTANCEFROMEVENT = parseddata.DISTANCEFROMEVENT[i];            

            var labelDesc = Ti.UI.createLabel({
                text : VAIRABLE2,
                font : {
                    fontFamily : 'Arial',
                    fontSize : 16,
                    fontWeight : 'bold'
                },
                //                  color : '#FFFFFF',
                //                  width:'auto',
                //                  textAlign:'left',
                top : 2,
                left : 40,
                height : 16
            });

            var labelDetails = Ti.UI.createLabel({
                text : DISTANCEFROMEVENT,
                font : {
                    fontFamily : 'Arial',
                    fontSize : 12,
                    fontWeight : 'bold'
                },
                //                  color : '#FFFFFF',
                //                  width:'auto',
                //                  textAlign:'left',
                bottom : 0,
                left : 60,
                height : 12
            });

            var labelDist = Ti.UI.createLabel({
                text : DISTANCEFROMEVENT,
                font : {
                    fontFamily : 'Arial',
                    fontSize : 12,
                    fontWeight : 'bold'
                },
                //                  color : '#FFFFFF',
                //                  width:'auto',
                //                  textAlign:'right',
                bottom : 0,
                right : 2,
                height : 12
            });

            // apply rows to data array
            row.add(labelDesc);
            row.add(labelDetails);
            row.add(labelDist);
            tableData.push(row);
        }
        lastRow = c;
        // and push this into our table.
        eventslisttable.setData(tableData);

Upvotes: 0

Views: 97

Answers (2)

Terran Brown
Terran Brown

Reputation: 529

OK - found by removing 'height' every thing started to work again....

Thanks for your help Mitul

Upvotes: 0

Mitul Bhalia
Mitul Bhalia

Reputation: 1217

I do not see code for row so try to set row's height to Ti.UI.SIZE and all the lable's width to Ti.UI.SIZE

and most important thing is be sure that you are getting values of VAIRABLE2 and DISTANCEFROMEVENT

Upvotes: 0

Related Questions