Skip to content

Instantly share code, notes, and snippets.

@freshteapot
Created January 31, 2012 19:37
Show Gist options
  • Save freshteapot/1712454 to your computer and use it in GitHub Desktop.
Save freshteapot/1712454 to your computer and use it in GitHub Desktop.
Using zeptos within Titanium with mustache.js
<html>
<head>
<script type="text/javascript" src="/html/js/zepto.min.js"></script>
<script>
$(document).ready(function(){
$("table").live('click', function (event){
event.stopPropagation();
var e = event.target;
Ti.API.info(e.tagName);
if (e.tagName.toLowerCase() === "span") {
Ti.API.info($(e).closest("tr").data("id"));
Ti.App.fireEvent("show:itemView", {
"item_id": $(e).closest("tr").data("id")
});
}
});
});
</script>
<style>
td{padding:10px 10px 10px 10px;
border-bottom:1px solid #c3c3c3;}
a{
display:block;
font-size:20px;
color:#ff0000;
text-decoration:none;
}
</style>
</head>
<body>
<table>
{{#list_items}}
<tr data-id="{{ID}}">
<td>
<span onclick="void(0)">{{{data}}}</span>
</td>
</tr>
{{/list_items}}
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment