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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:00:57+00:00 2026-06-06T16:00:57+00:00

Here is my Model View and Collection : window.Report = Backbone.Model.extend({}); window.ReportCollection = Backbone.Collection.extend({

  • 0

Here is my Model View and Collection :

window.Report = Backbone.Model.extend({});
window.ReportCollection = Backbone.Collection.extend({
   model: Report,     

   initialize: function(properties){
       this.url = properties.url;
   }
});

window.ReportCollectionView = Backbone.View.extend({
     initialize: function(){                   
        this.collection.reset();
        this.render();            
    },

    render: function(){
        var self = this;

        this.collection.fetch({

            success: function(){
                    self.collection.each(function(model){
                    //pass model to subview  
                    });
                }
            }
        });    

    }
});

in the other part of the code I use the instantiate the above objects

   var reportCollection = new ReportCollection({url:someURL});
   var reportCollectionView = new ReportCollectionView({collection:reportCollection});

‘someURL’ is a REST based URL that returns JSON list of Objects

So far everything looks good. What I am trying to achieve is:
I must be able to refresh the ‘reportCollection’ by changing the url and this should trigger an updated ‘reportCollectionView’. Thanks for any pointers

  • 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-06T16:00:58+00:00Added an answer on June 6, 2026 at 4:00 pm

    I suppose you could add a method to your collection which changes url and forces a fetch:

    window.ReportCollection = Backbone.Collection.extend({
        //...
        changeUrl: function(url) {
            this.url = url;
            this.fetch();
        }
    });
    

    and then bind to the "reset" event in your view:

    window.ReportCollectionView = Backbone.View.extend({
        initialize: function() {
            _.bindAll(this, 'render');
            this.collection.on('reset', this.render);
            this.collection.reset();
        },
        //...
    });
    

    Then if you do this:

    c = new ReportCollection(...);
    v = new ReportCollectionView({ collection: c, ... });
    

    You’ll get your rendered view and then later you can:

    c.changeUrl(...);
    

    to set the new URL and that will trigger a render call on v.

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

Sidebar

Related Questions

By 'view' here I mean different combinations of properties of the model, not the
I have a model : window.LayerModel = Backbone.Model.extend({ defaults:{ 'id':'unknow', 'type':'unkonw', 'preId':'unknow', 'data': {}
I'm using ASP.NET MVC 2 and here's the issue. My View Model looks something
I've seen examples in backbone.js where it says the initial model collection should be
MVC stands for model, view and controller. Backbonejs.or explains this by comparison to Rails,
I am building a comment object using Backbone.js. The URL in the collection returns
I am currently using Backbone.js collection and View and I am attempting to bind
I am creating a breadcrumb partial view which takes in a collection of title/URL.
here the following code is used to view the present modal view controller. [[self
Short question - how do you define your view models? Here are some of

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.