Created
June 21, 2012 07:20
-
-
Save alg/2964374 to your computer and use it in GitHub Desktop.
Exposing an interface between windows in Titanium
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
//error when the a table row is clicked in nearme_window.js | |
[WARN] Exception in event callback. { | |
line = 59; | |
message = "'undefined' is not a function (evaluating 'pub_win.update_pub_details('blah')')"; | |
name = TypeError; | |
sourceId = 233027648; | |
} | |
//nearme_window.js | |
module.exports = (function() { | |
var self = this, | |
pub_win = require('fb/ui/pub_window'), | |
win = gui.createWindow({ | |
title: L('title_nearme') | |
}), | |
nav = Titanium.UI.iPhone.createNavigationGroup({ window: win }); | |
var refresh = function() { | |
api.getNearbyPubs(function(response_json) { | |
var table = Ti.UI.createTableView(); | |
createTableData(response_json, table); | |
table.addEventListener('click', function(e){ | |
pub_win.update_pub_details(e.rowData); | |
nav.open(pub_win, {animated:true}); | |
}); | |
win.add(table); | |
}); | |
} | |
//pub_window.js | |
var lbl_pub_name = null; | |
exports.update_pub_details = function(pub_list_row) { | |
lbl_pub_name.text = pub_list_row.pub_name; | |
} | |
module.exports = function() { | |
lbl_pub_name = Ti.UI.createLabel({ | |
... | |
return win; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment