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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:06:50+00:00 2026-06-03T14:06:50+00:00

When is it appropriate to filter a collection vs. having several collections in Backbone?

  • 0

When is it appropriate to filter a collection vs. having several collections in Backbone?

For example, consider a music library app. It would have a view for displaying genres and another view for displaying the selected genre’s music.

Would you rather make one huge collection with all the music and then filter it or several smaller ones?

Having just one collection would allow you add features for filtering by other attributes as well, but suppose you have tons of music: how do you prevent loading it all in when the application starts if the user if only going to need 1 genre?

  • 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-03T14:06:51+00:00Added an answer on June 3, 2026 at 2:06 pm

    I think the simplest approach is having a common unique Collection that, intelligently, fetch an already filtered by genre data from the server:

    // code simplified and no tested
    var SongsCollection = Backbone.Collection.extend({
      model: Song,
      url: function() {
        return '/songs/' + this.genre;
      },
      initialize: function( opts ){
        this.genre = opts.genre;
      }
    });
    
    var mySongsCollection = new SongsCollection({ genre: "rock" });
    mySongsCollection.fetch();
    

    You have to make this Collection to re-fetch data from the server any time the User changes the selected genre:

    mySongsCollection.genre = "punk";
    mySongsCollection.fetch();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying use a set of filter functions to run the appropriate routine,
Is the following example appropriate for PHP's require_once construct? function foo( $param ) {
What is the most appropriate .Net exception type for when you have a class
I have a toolbar filter set up that works on a JQGrid of mine.
I have a list of emails and domains which I am trying to filter
Which is the appropriate (more readable) way of naming enumerator? will you consider: enum
I've added the appropriate configuration arrays to database.php and they work, however, I would
I have a Rails app with a few model classes (e.g. Category , Subcategory
I would like to have a custom snippet of html form code that takes
I have searched and have found almost nothing, so I would really appreciate some

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.