Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone.js with non RESTful app? (is Backbone.js right for my current project?)
    primarykey
    data
    text
    <p>I'm trying to figure out if Backbone.js is the right framework for my current project: a visualization app.</p> <p>I have a number of questions:</p> <p><strong>1) State / Routing?</strong></p> <p>As this is not your typical RESTful app, but rather a visualization application with various chart types and settings for these charts, how do i maintain state in the URL? Let's say my areaChart model has a number of defaults like this:</p> <pre><code>AreaChartModel = Backbone.Model.extend({ defaults: { selectedCountries: [], year: 1970, stacked: false }, initialize: function(){ [...] } }); </code></pre> <p>On an update to the model I'd like to serialize some of these attributes so that I can bookmark the specific state: chartApp.html#!year=1970&amp;stacked=false etc.</p> <p>And vice-versa, when initing the app with this state, how do I "deparam" the url state and set the model? Can I use Backbone's intrinsic routing?</p> <p><strong>2) Controller and coupling?</strong></p> <p>It seems as Backbone has a pretty tight view-model coupling? Is this really how I should bind for example my areaChartView to the model?</p> <pre><code>AreaChartView = Backbone.View.extend({ initialize: function(){ areaChartModel.bind("change:year", this.render); } }); </code></pre> <p>Isn't this normally the role of the controller?</p> <p><strong>3) Continuation: Model vs. Controller?</strong></p> <p>Given this scenario:<img src="https://i.stack.imgur.com/MW1zi.png" alt="enter image description here"></p> <p>A change in the "Sidebar" should trigger a sequence of functions:<br> 1) "New data for the current selection should be loaded"<br> 2) "Based on this data, the scales in the Visualization view should be updated"<br> 3) "The visualization view should be rendered"</p> <p>Where should I place these functions and how can I create an event in the model that I trigger when the state is stable? (i.e. when all the functions have been invoked and it's time to set the view states?)</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.
    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