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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:48:48+00:00 2026-06-10T02:48:48+00:00

In the data-driven paradigm of Backbone, the backbone views/routers should subscribe to model changes

  • 0

In the data-driven paradigm of Backbone, the backbone views/routers should subscribe to model changes and act based on the model change events. Following this principle, the application’s views/routers can be isolated from each other, which is great.

However, there are a lot of changes in the states of the applications that are not persisted in the models. For example, in a to-do app, there could be buttons that lets you look at tasks that are “completed”, “not completed”, or “all”. This is an application state not persisted in the model. Note that the completion state of any task is persisted, but the current filter in the view is a transient state.

What is a good way to deal with such application state? Using a plain, non-backboned state means that the views/routers cannot listen to the changes in this state, and hence become difficult to code in the data-driven paradigm.

  • 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-10T02:48:50+00:00Added an answer on June 10, 2026 at 2:48 am

    Your buttons filter example can be properly solved using Model events.

    I suppose your buttons handlers have access to the tasks Collection. Then filter the collection and trigger events over the selected Models like:

    model.trigger( "filter:selected" )
    

    or

    model.trigger( "filter:un-selected" )
    

    The ModelView can be listening to these events on its Model and acts accordingly.

    This is following your requirements of respecting the not use or “attributes that are not persistent” like selected but I don’t have any trauma to use special attributes even if they shouldn’t be persistent. So I also suggest to modify the selected attribute of your Models to represent volatile states.

    So in your buttons handlers filter the collection and modify the selected attribute in your Models is my preferred solution:

    model.set( "selected", true )
    

    You can always override Model.toJSON() to clean up before sync or just leave this special attributes to travel to your server and being ignored there.

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

Sidebar

Related Questions

I am using data-driven test suites running JUnit 3 based on Rainsberger's JUnit Recipes
I have a legacy data-driven application with an extremely complicated data model (and hundreds
I have built a data driven model by dragging my tables onto the empty
I try to create Data Driven Menu in MVC 3. So i complete following
I have a number data-driven web based applications that serve both internal and public
I'm rewriting a data-driven legacy application in Python. One of the primary tables is
I am developing a data driven website and quite a lot of programming logic
I've built a data-driven google map with different icons that get assigned to the
I was reading about data driven testing using mbunit from this article. http://blog.benhall.me.uk/2007/04/mbunit-datafixture-data-driven-unit.html I
I'm trying to define a Data Driven Subscription for a report in SSRS 2005.

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.