Note that there are some explanatory texts on larger screens.

plurals
  1. POPreferred pattern for master-detail scenario in Backbone.js
    primarykey
    data
    text
    <p>The majority of Backbone tutorials that deal with master-detail scenarios handle the detail state by creating new views with models passed from routes (<a href="http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/" rel="nofollow">example</a>). I'm wondering what the alternative options are what the pros and cons are for each.</p> <p>The thing that has always stood out to me about this approach of instantiating new views is that it seems like a missed opportunity to make use of Backbone's model-view binding. I.e., create a single detail view that updates based on the selected model. But this would require a separate model concerned only with the UI / active state.</p> <p>I can think of three different patterns:</p> <ul> <li>Create/Destroy views for each active detail. (This seems like excess work, not to mention potential <a href="http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/" rel="nofollow">zombie problems</a>)</li> <li>Maintain an additional model that represents the active detail and create one view that re-renders itself when the model updates</li> <li>Create one view with a method that swaps out the associated model (I think this can lead to event binding problems and is probably not a good idea)</li> </ul> <p>In the context of a simple case like the example tutorial linked above, what are the pros/cons? Is the idea in #2 of using a UI model a bad practice? Are there other solutions? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload