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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:31:11+00:00 2026-05-22T23:31:11+00:00

I am very new at using Backbone. Please forgive me in advance as I

  • 0

I am very new at using Backbone. Please forgive me in advance as I am struggling to think in new ways building web apps.

I am confused about how to go about using it for items that are never really covered in any of the tutorials. All the tutorials give the basic “here is a model”, “here is a collection of models”, “here is a view that uses the model”, etc. for entities that we all understand, such as a to-do item.

I do have those cases, and I am doing OK with those, but I am having trouble figuring out how to use Backbone for the following situation.

I have a to-do app (of course.) My UI needs to have several menus that allow the user to filter the to-dos by things like priority, due date, and other properties. So, my filter menus might look like this…

  • All To-Dos (100)
  • Inbox (15)
  • Important (10)
  • Someday (15)
  • Today (0)
  • Tomorrow (6)
  • This Week (7)

These are all somewhat static menus, except that when a filter is clicked, it should highlight, and possibly cause another filter to be turned off. Also, this would trigger an update in my results by performing a search and re-rendering my to-do list.

So, should I represent these items with views only? Are models needed to represent the state of the menus? Should I create a FilterMenuItem model and FilterMenu model, and also the corresponding views?

Again, I understand the samples when it comes to a model for a to-do item and a to-do collection, but I am stumped on how to tackle these seemingly simple items using Backbone.

I appreciate any suggestions or guidance.

  • 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-22T23:31:12+00:00Added an answer on May 22, 2026 at 11:31 pm

    The important thing to remember here is that collections in backbone.js inherit a bunch of cool features from underscore.js. Included in these is filter (or select), which allows you to get only those members of a collection which match your perameters. For example:

    render: function(){
        myCollection.filter(function(item){return item.folder === "inbox"});
    }
    

    If the menus are actually static, then you can use a case select statement to determine which page you are on & therefore which filter to use. Otherwise, you can have an array of objects representing the views, which describe how to filter, i.e.:

    [
        {view: "all", filter: function(item){return item;}}.
        {view: "inbox", filter: function(item){return item.foler === "inbox";}}, 
        {view: "important", filter: function(item){return item.type === "important;}}
    ]
    

    As far as producing the view for your menu items goes, you have to decide if the the menu is static or not. If it is, then you can simply hard-code the items to different controller routes. If it is not, then you should probably use a collection of menuItem models:

    var menuItem = Backbone.Model.extend({});
    var menuList = Backbone.Collection.extend({
        model: menuItem
    });
    var menu = new menuList([{name: "All To-Dos", url: "#!/all"}, {name: "index", url: "#!/index"}]);
    

    which you can add or remove items to dynamically, as well as having the options built from the server specifications (i.e. the user may be able to save custom folders, which will get added here) use the refresh command to avoid unneccesary http calls. Then, you can pass this collection to your view, and render the items out however you want.

    Hope this helps!

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

Sidebar

Related Questions

I am very new to web development. I am currently using tablesorter jquery plugin
I am very new to using preg_replace and such so please bear with me.
I'm very new to Selenium RC. I'm using .NET (though I don't think it
New to using Backbone and have a very simple application. Basically there are Clients
I'm very new to using jQuery so please excuse me if this question is
Very new to using Raphael.js I'm looking at the tutorials and I am able
I am very new to using dependency injection, and I am trying it out
I am very new to using SQL and I haven't been able to find
I'm very new to Ruby and using Sinatra, mainly so that I can do
I am very new to NTLM/LDAP and trying to authenticate using NTML running on

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.