-
-
Save nvdnkpr/4218013 to your computer and use it in GitHub Desktop.
Basic Alloy : Dynamic TableView Handling
This file contains hidden or 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
function showItems(e) { | |
Ti.API.info(e.rowData.itemName); | |
} | |
var rowData=[]; | |
for(var i=1;i<=10;i++){ | |
var payload={ | |
rowId:i, | |
itemName:'Test' + i | |
} | |
var row=Alloy.createController('row',payload).getView(); | |
rowData.push(row); | |
} | |
$.itemsList.data=rowData; | |
$.win.open(); |
This file contains hidden or 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
"#container": { | |
backgroundColor:"white" | |
} |
This file contains hidden or 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
<Alloy> | |
<Window id="win"> | |
<TableView id="itemsList" onClick="showItems"> | |
</TableView> | |
</Window> | |
</Alloy> |
This file contains hidden or 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
var args = arguments[0] || {}; | |
$.row.rowId=args.rowId; | |
$.row.itemName=args.itemName; | |
$.itemName.text=args.itemName; |
This file contains hidden or 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
"#row":{ | |
height: "40dp", | |
hasChild: true | |
}, | |
"#itemName": { | |
width: Ti.UI.SIZE, | |
height: Ti.UI.SIZE, | |
color: "#000", | |
left: 0 | |
} |
This file contains hidden or 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
<Alloy> | |
<TableViewRow id="row" rowId="1" itemName="Test1"> | |
<Label id="itemName">Test 1</Label> | |
</TableViewRow> | |
</Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment