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

  • Home
  • SEARCH
  • 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 6736357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:07:13+00:00 2026-05-26T11:07:13+00:00

I am creating a webapp where user creates an inventory of items and he

  • 0

I am creating a webapp where user creates an inventory of items and he uses folders to categorize them. Now suppose I have two folders like this:

  • All items (route: /)
  • Closet items (route: #get/closet/id)

When I navigate between these routes, I want to dispose of the models rendered in the previous route. How and where should I do that? Is there an event which is triggered when I navigate to a new route where may be I can perform this operation?

  • 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-05-26T11:07:13+00:00Added an answer on May 26, 2026 at 11:07 am

    There are lots of ways to approach this, and it really depends on how you’re doing the navigation. If you’re changing routes with actual links, or by using router.navigate(), your router will dispatch a route:<route name> event that you can listen to, passing the same arguments to the handler as it passes to the route function.

    In what turned out to be a demonstration of just how long it takes to set up test case code with Backbone, I made you a jsFiddle to illustrate this approach: http://jsfiddle.net/nrabinowitz/ZrgJF/7/

    A lot of this is just setup code; the important parts for this question are the router:

    var MyRouter = Backbone.Router.extend({
        routes: {
            'view/:id' : 'openView'
        },
        openView: function(id) {
            app.openView(id)
        }
    });
    router = new MyRouter();
    

    And the view, which binds removal to the route:

    var MyView = Backbone.View.extend({
        initialize: function(opts) {
            this.id = opts.id;
            router.bind('route:openView', this.dispose, this); 
        },
        // id is the same as the route argument
        dispose: function(id) {
            if (id != this.id) {
                this.remove();
            }
        }
        // etc
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a webapp with EclipseLink for the persistence layer, and I have
I have been busy in my project creating a webapp (in struts) that manages
I am creating an iPhone webapp with a textbox and would like to change
I'm creating a web app with various classes for things like the user, Smarty
I have a web app I'm creating, where I need to allow the user
I have a Java webapp creating a pdf and streaming it back to the
I'm creating a backbone view for displaying a list of folders created by user
I'm creating a webapp using Pyramid with Beaker sessions. I would like to store
When creating a project with the webapp archetype in Maven, they subtly advise not
I'm in the process of creating a header section for a webapp. I'm having

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.