Created
May 18, 2011 01:54
-
-
Save hvgotcodes/977849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
miles.ui.createEntryRows = function(entries) { | |
var rows = []; | |
Ti.API.info("Rendering rows: " + entries.length); | |
var count = 0; | |
for (var i = 0; i < entries.length; i) { | |
count++; | |
if (count > 10) { | |
Ti.API.error('emergency break'); | |
break; | |
} | |
var entry = entries[i], | |
start = entry.start, | |
end = entry.end, | |
startDate = entry.startDate, | |
endDate = entry.endDate; | |
var rowContainer = Ti.UI.createTableViewRow({ | |
height:'auto', | |
hasChild : true, | |
backgroundGradient: { | |
type: 'linear', | |
colors: ['#E6E6E6','#FEFEFF'], | |
backFillStart: true | |
} | |
}); | |
var row = Titanium.UI.createView({ | |
height:'auto', | |
layout:'vertical', | |
top:2, | |
right:2, | |
bottom:2, | |
left: 2 | |
}); | |
var startDateLabel = Titanium.UI.createLabel({ | |
text: entry.displayStartDate(), | |
top: 2, | |
height: 16, | |
width: 'auto', | |
textAlign: 'center', | |
font: miles.ui.utils.boldFontHash | |
}); | |
var startLabel = Titanium.UI.createLabel({ | |
text: 'Start: ' + start, | |
height: 16, | |
width: 'auto', | |
top: 2, | |
left: 2, | |
textAlign: 'left', | |
font: miles.ui.utils.fontHash | |
}); | |
var endLabel = Titanium.UI.createLabel({ | |
text: 'End: ' + end , | |
height: 16, | |
width: 'auto', | |
left: 100, | |
top: -16, | |
textAlign: 'left', | |
font: miles.ui.utils.fontHash | |
}); | |
var totalLabel = Titanium.UI.createLabel({ | |
text: 'Total: ' + entry.totalMiles(), | |
height: 16, | |
width: 'auto', | |
left: 200, | |
top: -16, | |
textAlign: 'left', | |
font: miles.ui.utils.fontHash | |
} | |
); | |
row.add(startDateLabel); | |
// row.add(endDateLabel); | |
row.add(startLabel); | |
row.add(endLabel); | |
row.add(totalLabel); | |
rowContainer.add(row); | |
rows.push(rowContainer); | |
} | |
return rows; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment