Skip to content

Commit

Permalink
Merge pull request #1 from pingwang2011/timob-8170
Browse files Browse the repository at this point in the history
timob-8170: Titanium Mobile Template: Template.MasterDetail: needs a back button on the new opened window
  • Loading branch information
nebrius committed Mar 23, 2012
2 parents e83ee63 + 65ac4a3 commit ca3012d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Resources/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ if (Ti.version < 1.8 ) {
Window = require('ui/tablet/ApplicationWindow');
}
else {
// iPhone makes use of the platform-specific navigation controller,
// iPhone and Mobile Web make use of the platform-specific navigation controller,
// all other platforms follow a similar UI pattern
if (osname === 'iphone') {
Window = require('ui/handheld/ios/ApplicationWindow');
}
else if (osname == 'mobileweb') {
Window = require('ui/handheld/mobileweb/ApplicationWindow');
}
else {
Window = require('ui/handheld/android/ApplicationWindow');
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/ui/handheld/ios/ApplicationWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function ApplicationWindow() {
});
detailContainerWindow.add(detailView);

//createiOS specific NavGroup UI
//create iOS specific NavGroup UI
var navGroup = Ti.UI.iPhone.createNavigationGroup({
window:masterContainerWindow
});
Expand Down
42 changes: 42 additions & 0 deletions Resources/ui/handheld/mobileweb/ApplicationWindow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function ApplicationWindow() {
//declare module dependencies
var MasterView = require('ui/common/MasterView'),
DetailView = require('ui/common/DetailView');

//create object instance
var self = Ti.UI.createWindow({
backgroundColor:'#ffffff'
});

//construct UI
var masterView = new MasterView(),
detailView = new DetailView();

//create master view container
var masterContainerWindow = Ti.UI.createWindow({
title:'Products'
});
masterContainerWindow.add(masterView);

//create detail view container
var detailContainerWindow = Ti.UI.createWindow({
title:'Product Details'
});
detailContainerWindow.add(detailView);

//create Mobile Web specific NavGroup UI
var navGroup = Ti.UI.MobileWeb.createNavigationGroup({
window:masterContainerWindow
});
self.add(navGroup);

//add behavior for master view
masterView.addEventListener('itemSelected', function(e) {
detailView.fireEvent('itemSelected',e);
navGroup.open(detailContainerWindow);
});

return self;
};

module.exports = ApplicationWindow;

0 comments on commit ca3012d

Please sign in to comment.