I'm having a navigationWindow that calls a child
main.js
function openTableView(e) { var win3 = Alloy.createController('tableView').getView(); $.win1.openWindow(win3); }The child has a TableView. It gets filled calling a static function out of a commonJS module
child.js
var myCommonJSModule = require('myCommonJSModule'); var data = null; var i = 0; alert('I am here'); while(data == null) { //tried to fix with loop data = myCommonJSModule.getData(); i++; } alert(i); //never reach this point when opening the window a second time $.tableView.setData(data);The commonJS module looks like this:
myCommonJSModule.getData = function() { var db = Ti.Database.open(_databaseName); var resultSet = db.execute('SELECT * FROM ' + _tableName); var result = []; while (resultSet.isValidRow()) { //create tableViewRow result.push(row); resultSet.next(); } resultSet.close(); db.close(); return result; };In debug mode it works fine. But without the debugger or on the device the child call failes after it has been opened once. I tried to fix it with a loop, but this didn't help. I even don't get any error/exception.
What could be causing this issue?