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 7403849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:10:09+00:00 2026-05-29T05:10:09+00:00

when my page opens, I call the collection and populate the view: var pagColl

  • 0

when my page opens, I call the collection and populate the view:

var pagColl = new pgCollection(e.models); 
var pagView = new pgView({collection: pagColl});

Separately (via a Datepicker), I wish to want to populate the same collection with different models and instantiate the view again.

The problem I have is how to close the original pagView and empty the pagColl before I open the new one, as this “ghost view” is creating problems for me. The variables referred to above are local variables? is it that I need to create a global pagColl and reset() this?

  • 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-29T05:10:09+00:00Added an answer on May 29, 2026 at 5:10 am

    well there has been many discussion on this topic actually,
    backbone does nothing for you, you will have to do it yourself and this is what you have to take care of:

    1. removing the view (this delegates to jQuery, and jquery removes it from the DOM)

      // to be called from inside your view... otherwise its  `view.remove();`
      this.remove();
      

      this removes the view from the DOM and removes all DOM events bound to it.

    2. removing all backbone events

      // to be called from inside the view... otherwise it's  `view.unbind();`
      this.unbind();
      

      this removes all events bound to the view, if you have a certain event in your view (a button) which delegates to a function that calls this.trigger('myCustomEvent', params);

    if you want some idea’s on how to implement a system I suggest you read up on Derrick Bailey’s blogpost on zombie views: http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/.

    another option

    another option would be to reuse your current view, and have it re-render or append certain items in the view, bound to the collection’s reset event

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a page that opens in a new browser window where there's an
I'm working with a fairly common pattern - a page opens a child window
I have an app that display's the current time when a page opens. I
I have a page that opens a modal dialog. After the operations done on
Hi I have a web page that opens up from another page after the
running git instaweb in my repository opens a page that says 403 Forbidden -
I have written a ruby script which opens up dlink admin page in firefox
I have a Menu page. If a user selects an Menu Item it opens
I have a Site Map link that opens up a Web Resource .htm page.
I have a page with two buttons, one Button opens a popup window with

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.