Created
November 23, 2012 20:27
-
-
Save ricardoalcocer/4137144 to your computer and use it in GitHub Desktop.
Basic Alloy : Dynamic TableView Handling + Open Window
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
var args = arguments[0] || {}; | |
$.rowId.text=args.rowId; | |
$.itemName.text=args.itemName; | |
function closeme(){ | |
$.win.close(); | |
} |
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
".container": { | |
backgroundColor: "yellow", | |
layout:"vertical" | |
}, | |
"#itemName":{ | |
height: Ti.UI.SIZE, | |
left: 0 | |
}, | |
"#rowId":{ | |
height: Ti.UI.SIZE, | |
left: 0 | |
}, | |
"#closebtn":{ | |
height: Ti.UI.SIZE, | |
width: Ti.UI.SIZE | |
} |
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
<Alloy> | |
<Window id="win" class="container"> | |
<Label id="itemName"></Label> | |
<Label id="rowId"></Label> | |
<Button id="closebtn" onClick="closeme">Close Me</Button> | |
</Window> | |
</Alloy> |
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
function showItems(e) { | |
Ti.API.info(e.rowData.itemName); | |
var payload={ | |
rowId:e.rowData.rowId, | |
itemName:e.rowData.itemName | |
} | |
var w=Alloy.createController('detailwin',payload).getView(); | |
w.open(); | |
} | |
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 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 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 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 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 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
Thanks ! Need this in the official documentation