Skip to content

Instantly share code, notes, and snippets.

@luiselizondo
Created July 6, 2015 03:50
Show Gist options
  • Save luiselizondo/3e9ea3e2f7295911c7fd to your computer and use it in GitHub Desktop.
Save luiselizondo/3e9ea3e2f7295911c7fd to your computer and use it in GitHub Desktop.
Master Detail Model Binding in Appcelerator
var args = arguments[0] || {};
function main() {
var $model = args.model;
var model = $model.toJSON();
var collection = Alloy.Collections.book;
var book = Alloy.createModel("book", $model);
book.fetch({id: modelId});
book.on("fetch", function(data) {
console.log(data);
});
}
main();
// $model is a special variable that has access to the TableViewRow element
function onClick(e) {
var detailWindow = Alloy.createController("detail", {
model: $model
}).getView();
// Alloy.Globals.homeTab is set in index.js to the Tab opened
Alloy.Globals.tabGroup.activeTab.open(detailWindow, {animated: true});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment