Created
April 30, 2014 00:40
-
-
Save tdtsh/a119a2484b4c545b896c 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
Titanium Alloy での ListView のイベントハンドリング | |
Alloyでのclickイベント制御の書き方の一例です。 | |
```/app/controller/sample.js | |
var data = []; | |
... | |
data.push({ | |
template: "MyItemTemplate", | |
tags: { text : "hoge" }, | |
.... | |
$.sectionA.setItems(data); | |
... | |
function onItemClick(e) { | |
var item = e.section.getItemAt(e.itemIndex); | |
if (e.bindId === "tags") { | |
Ti.API.info("This is hoge: " + item.labelA.text); | |
handleTagClickEvent(); | |
} | |
} | |
``` | |
```/app/view/sample.xml | |
<Alloy> | |
<Window> | |
<ListView id="listA" onItemclick="onItemClick"> | |
<Templates> | |
<ItemTemplate name="MyItemTemplate"> | |
<Label id="labelA" bindId="tags"/> | |
... | |
</Templates> | |
<ListSection id="sectionA" /> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment