Questions tagged [marionette]

Backbone.Marionette is a composite application library for Backbone.js that aims to simplify the construction of large scale JavaScript applications. Do NOT use this tag for Firefox's Marionette driver. Use the firefox-marionette tag instead.

Backbone.Marionette is a collection of common design and implementation patterns found in the applications that we have been building with Backbone, and includes pieces inspired by composite application architectures, event-driven architectures, messaging architectures, and more.

Important to note that Marionette introduced some breaking changes in their API when moving from 1.X to 2.X below is a quick summary of the main breaking changes that can cause errors in your app, a full report on the changes can be found on google docs.

General

  • All instances of the word type in the API have been replaced with the word class. For instance:
    • regionType => regionClass
    • ChildViewType => ChildViewClass

Applications and Modules

  • Application’s initialize triggerMethods have been renamed to start, which is more descriptive of what is actually happening. More specifically, initialize:before and initialize:after are now before:start and start, respectively. Note that no functionality has been lost with this change; it is merely a changing of names.

Controllers

  • close has been renamed to destroy to emphasize the fact that an instance should not be reused, or ‘opened,’ after it is destroyed

Regions

  • Regions now expose region.el and region.$el, just like View’s. Due to this change if you were depending on region.el to be a string selector you must update your code to use region.$el.selector.

  • The open method has been renamed to attachHtml

Views

  • Layout is now called LayoutView
  • Renamed close to destroy for views. Close was a confusing verb for users who thought that they could be reopened. The verb destroy makes it more clear that once a view is destroyed you can not reuse it.
  • Returning false from onBeforeClose no longer prevents the view from closing
  • appendHtml has been renamed to attachHtml.
  • appendBuffer has been renamed to attachBuffer
  • Removes duplicate and inconsistent itemView events. No functionality was lost with this change; simply use the unprefixed version instead. For instance, use before:render instead of item:before:render
  • childEvents callbacks no longer receives the event name as the first argument
  • itemView within a collectionView is now known as childView. This removes confusion for new users as to the fact that you can show any type of view in your collectionView.
  • All CollectionView methods that referenced itemView now use the same childView as well. For instance, getItemView is now getChildView. Do note that CompositeViews extend from CollectionView, so these API changes affect that Class as well.

References

2383 questions
0
votes
0 answers

Reference to div element is null when navigating away from view

I am referencing a div in the initialize function for a backbone.marionette view. The issue I am having is when I navigate away from that view and come back the reference to that div is null. for example: var div =…
0
votes
3 answers

CollectionView - collection data not being passed to childView

I'm trying to make the collectionView work , but I'm not really sure whether the CollectionView initiates the fetch method automatically and then populates the ChildViews with the fetched data. Or is it something I need to do manually? I have…
Alexus
  • 1,887
  • 1
  • 23
  • 50
0
votes
0 answers

Marionette not triggering events in modal window

I have a simple ItemView that's being rendered inside a modal window, using the technique of a custom modal region. I have several modal regions on top of each other, and it does not seem to affect negatively the events of other views (that are also…
George Silva
  • 3,454
  • 10
  • 39
  • 64
0
votes
1 answer

Marionette nested LayoutView - parsing model

I have Marionette/Backbone appliaction which is working fine. I wanted to add extra layer in our views: Before: TabLayoutView -> CompositeView After: TabLayoutView -> SectionLayoutView -> CompositeView But this is not working and I can't see…
0
votes
1 answer

Backbone view's 'this' context in bootbox

I am trying to make the creation of my new object happen inside a bootbox modal. How can i access this.collection inside the bootbox callback? it seems to me that _bind would be useful, but i dont know how. the following happens inside a…
Emilios1995
  • 487
  • 5
  • 20
0
votes
1 answer

Stickit dynamic binding for newly created select element

In my project I am using Marionette with stickit for two way data binding. In there I need to clone div element which has select and textbox. var $template = $('#template-clone'); var $clone = $template.clone(); $clone.show(); var observeSelectID…
Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69
0
votes
2 answers

Marionette CompositeView - change in template each nth items

I'm using Marionette for a while, but I'm not sure how I can do what I want, in a simple manner. I have a composite view, which renders something like this:
Each…
George Silva
  • 3,454
  • 10
  • 39
  • 64
0
votes
3 answers

backbone marionette pass variable to view method

I have simple situation and can't understand why variable that I pass to function always undefined. var ProjectItemView = Backbone.Marionette.ItemView.extend({ template: "#ProjectItemTemplate", initialize: function () { …
Dmitry Novice
  • 155
  • 2
  • 12
0
votes
0 answers

Cannot add requirejs-text plugin in brunch-with-marionette application

I used brunch-with-marionette skeleton available at: https://github.com/SimbCo/brunch-with-marionette Everything works fine for me but I don't know the necessary configuration in this skeleton to add requirejs-text plugin. I tried: npm install…
user1344502
  • 75
  • 1
  • 1
  • 8
0
votes
1 answer

Marionette Regions and routing

I'm using a LayoutView to display a collection in table form. When a user clicks on a tr I swap the CompositeView for an ItemView that shows the details using the same region. It all works except the functionality of the back button is broken. Is…
jabbermonkey
  • 1,680
  • 4
  • 19
  • 37
0
votes
1 answer

Backbone.Marionette + Rails app redirects after form submission. Why?

I have a sample app that I'm working on that uses Ruby on Rails for the server backend and Backbone.Marionette for the client-side. The main functionality is a form to "order a widget". I'm using backbone-forms to create the form. The oddity that is…
smargh
  • 876
  • 9
  • 19
0
votes
1 answer

Marionette CompositeView Sort Rendering

I have a Marionette (2.4.1) CompositeView and when I do a sort it re-renders the entire view rather than the childView. The header icons revert back. I could fix them on render but is there a way that I can just render the childView? diaryEntries =…
jabbermonkey
  • 1,680
  • 4
  • 19
  • 37
0
votes
1 answer

Dynamically adding columns to BackGrid inside a Marionette view

So, I have a complicated Marionette app with several composite views. I am attempting to add a dynamic BackGrid to the view, but can't seem to get it to add columns. I create the grid and add it to the view as per this post: Backgrid integration.…
Deano
  • 1,136
  • 10
  • 19
0
votes
0 answers

Keeping values entered in template

In my underscore/marionette application, there's an interaction that involves switching between the radio buttons. When switching back I need to keep the entered form value. Here's what I've got so far: var myView = Marionette.ItemView.extend({ …
Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69
0
votes
0 answers

Backbone. Get all views which already exist on the page

Is it possible to get list of views (with their models and events) from the page?
1 2 3
99
100