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
1 answer

Override Backbone.Wreqr.radio handlers

At the company I work, we've decided to extract most of our Marionette.js code and split them up into several Rails Gems. At this moment, I've managed to split up Marionette Controllers and Views. Some of the stuff inside Marionette Controllers are…
Vernon
  • 443
  • 4
  • 23
0
votes
2 answers

Why my Marionette itemView does not render?

I'm using Marionette with Handlebars templates and I can't get my itemView to render inside a CollectionView. Here is the CollectionView code: define( [ 'App', 'marionette', 'handlebars', 'models/Model', 'collections/Collection',…
Draconar
  • 1,147
  • 1
  • 17
  • 36
0
votes
2 answers

Not able to load a region with Marionette.LayoutView

I'm loading a precompiled handlebars template in a layout view. I'm defining the regions, but, I get the error: Uncaught Error: An "el" #questions-section must exist in DOM (of course that node exists in the template). Is this happening because I'm…
sica07
  • 4,896
  • 8
  • 35
  • 54
0
votes
1 answer

Backbone Marionette - Wrapping A CollectionView From Left to Right

I have a very simple Collection View working exactly as expected. But, the underlying collection can get fairly long. The ItemViews themselves arent very wide. So, rather than have the Collection View run off the screen in a scrollable container,…
user163757
  • 6,795
  • 9
  • 32
  • 47
0
votes
2 answers

Javascript code trying to be executed as php

This is a wordpress plugin I've used Backbone Marionette to build the back-end. The problem is that the template code (html and javascript) its being execute as php. Fatal error: Call to undefined function substring() in ../main-menu.php on line…
nmos
  • 146
  • 1
  • 8
0
votes
1 answer

Creating a HTML table with Marionette views

I'm trying to output a table to the DOM with Backbone and Marionette Composite views, Collection views and Item views. My code is: var TableDataView = Backbone.Marionette.ItemView.extend({ tagName: "td", template:…
Mark
  • 4,428
  • 14
  • 60
  • 116
0
votes
1 answer

Syntax error, unrecognized expression: <> in jQuery in a Backbone/Marionette app

I ran into a cryptic error message from deep in the bowels of jQuery code. Uncaught Error: Syntax error, unrecognized expression: <> I'm sure the problem has nothing to do with jQuery itself. It's somewhere in my application, which is built in…
Patrick McElhaney
  • 57,901
  • 40
  • 134
  • 167
0
votes
0 answers

marionette router does not work. Cannot navigate to a route from address bar

I have a backbone marionette application with requirejs for loading module. Everything else is working just fine as expected. Until I put router in it. The router and controller binding does not seem to work. When I go to a route from address bar:…
Pravin
  • 1,671
  • 5
  • 23
  • 36
0
votes
1 answer

Is there another method, which exactly works as "onShow"?

So, I have one view(marionette itemview) which is to render the google maps based on the address given as input.This view is being used in three places of the application.Where as in two places, Case 1: I'm using regions to show the view(like:…
Swathi
  • 109
  • 1
  • 13
0
votes
1 answer

Call one app's view from another in Marionette

I have an IdentificationView that has to call a method of another view in different app: var NameAndIdentificationView = Application.Views.ItemView.extend({ loadMailingAddressView: function() { //call to mailing address view…
Abhishek
  • 1,974
  • 5
  • 31
  • 67
0
votes
3 answers

Getting the selected option when using Marionette CompositeView with select tag

I'm using a CompositeView to display a select tag, and the options are being rendered through using the CompositeView's collection. OptionView = Marionette.ItemView.extend({ template: ... tagName: "option", } }); SelectView =…
Dennis
  • 998
  • 7
  • 19
0
votes
1 answer

Marionette View - unable to reuse template

I have a module called GridView in which i extend Marionette.ItemView like given below: GridView.View = Marionette.ItemView.extend({ template: "#grid-view-template", showGrid: function(gridName) { .... }, .... } Whenever a…
user1862830
  • 53
  • 1
  • 5
0
votes
1 answer

Marionette - Events being triggered multiple times

I'm having troubles handling events between my views and collections. In the below example you can find a short version of what does my webapp look like and how are the events being handled now. What happens here is that when switching from menu1…
Alexus
  • 1,887
  • 1
  • 23
  • 50
0
votes
0 answers

Passing value from Marionette to aspx

I am new to Marionette but progressing day by day, I am in a situation where i have calculated value on Marionette.js file and i need to pass that value back to aspx, value is css height value, am attaching my code pic and let me know what i am…
Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
0
votes
1 answer

Capture event that creates all views on adding models to the existing collection backbone marionette

I have implemented the following functionality: define([ 'jquery', 'underscore', 'backbone', 'marionette', 'app', 'views/y/x/FlightScheduleLayoutView', 'collections/y/x/ScheduleCollection' ], function($, _, Backbone,…