Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8113535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:51:35+00:00 2026-06-06T02:51:35+00:00

I have a navigationgroup using which I have a Master and a DetailView. When

  • 0

I have a navigationgroup using which I have a Master and a DetailView. When opening the detailView using the MasterView, the navigationGroup automatically provides a button on the top bar to go back to the MasterView.

What I would like to acheive is to have a button on the detailView. On click of the button on the detailView, would like to process a job and then go back to the MasterView.

I am able to add a listener to the button on detailView and perform the desired job, but how do i close the detailView and go back to the MasterView?

Posted below is the code for 3 files

  • ApplicationWindow.js
  • MasterView.js
  • DetailView.js

ApplicationWindow.js

var MasterView = require('ui/common/MasterView'), DetailView = require('ui/common/DetailView');
    var masterView = new MasterView(), detailView = new DetailView();

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

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

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

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

masterContainerWindow.open();

MasterView.js

//Master View Component Constructor
function MasterView() {
    //create object instance, parasitic subclass of Observable
    var self = Ti.UI.createView({
        backgroundColor:'white'
    });

    //some dummy data for our table view
    var tableData = [
        {title:'Apples', price:'1.25', hasChild:true, color: '#000'},
        {title:'Grapes', price:'1.50', hasChild:true, color: '#000'},
        {title:'Oranges', price:'2.50', hasChild:true, color: '#000'},
        {title:'Bananas', price:'1.50', hasChild:true, color: '#000'},
        {title:'Pears', price:'1.40', hasChild:true, color: '#000'},
        {title:'Kiwis', price:'1.00', hasChild:true, color: '#000'}
    ];

    var table = Ti.UI.createTableView({
        data:tableData
    });
    self.add(table);

    //add behavior
    table.addEventListener('click', function(e) {
        self.fireEvent('itemSelected', {
            name:e.rowData.title,
            price:e.rowData.price
        });
    });

    return self;
};

module.exports = MasterView;

DetailView.js

function DetailView() {
    var self = Ti.UI.createView();

    var lbl = Ti.UI.createLabel({
        text : 'Please select an item',
        height : 'auto',
        width : 'auto',
        color : '#000'
    });
    self.add(lbl);

    self.addEventListener('itemSelected', function(e) {
        lbl.text = e.name + ': $' + e.price;
    });

    var btn = Ti.UI.createButton({
        text : 'Close Me'
    });

    btn.addEventListener('click',function(){
        //Do Opertation
        //Close Detail View
    });

    self.add(btn);
    return self;
};

module.exports = DetailView;

On the detailView, I have added a button named ‘btn’ which also has an eventListener. I would like to close the detailview using this button. Please advice.
Thanks and Regards

Abishek R Srikaanth

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:51:37+00:00Added an answer on June 6, 2026 at 2:51 am

    I created an custom EventListener for the detailView on ApplicationWindow, fired that event on button click. used the navGroup’s close event passing the detailContainerWindow.

    ApplicationWindow.js

    detailView.addEventListener('closeItem', function(e) {
                Ti.API.info('event called');
                navGroup.close(detailContainerWindow);
    
            });
    

    DetailView.js

    btn.addEventListener('click', function(e) {
                self.fireEvent('closeItem', e);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple one-off tasks which needs a progress bar. OpenSSL has a useful
Have any one tried to activate fancybox thumbnail gallery using a button or an
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you ever had to justify the choice over using .NET instead of Java
Have some code: using (var ctx = new testDataContext()) { var options = new
have a help file which i have created in Notepad++ with the following syntax
Have anyone used Redmine Documentor which lets you convert PHP to HTML to Redmine
Have the following scenario. I have a few form, which essentially have a few
Have just started to get into CakePHP since a couple of weeks back. I
Have a bunch of classes which I need to do serialize and deserialize from/to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.