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

How a childView listens to another childView events correctly using marionettejs?

So, I have a layoutView, lets call it MyLayoutView. In this layout view I have two childViews: return Marionette.LayoutView.extend({ template: templates.pages.layoutTpl, regions: { regionTest1: "#test1-view", regionTest2:…
rvpanoz
  • 75
  • 2
  • 9
0
votes
1 answer

Find out the code that is doing the GET in a Backbone Marionette application

I'm new to Backbone/Marionette. I've started reading documentation which is helping. However, I need some help on this one. I've been watching our app in Chrome Dev Tools and I see it's contacting a REST endpoint every 5 seconds. I would like to…
devwannabe
  • 3,160
  • 8
  • 42
  • 79
0
votes
1 answer

Debugging a marionette application

I'm very new to Backbone and Marionette and RequireJS. I am supporting an existing application that uses these frameworks. The app is huge. Where should I start looking? I want to learn which file gets loaded first, kinda like the entry point.
devwannabe
  • 3,160
  • 8
  • 42
  • 79
0
votes
1 answer

Why .filter() in Marionette.CollectionView doesn't work?

Why .filter() in Marionette.CollectionView doesn't work? It just isn't fired. P.S. Collection has one element. 1 file: documents = new Collections.Documents documents.fetch().done => @getRegion('certificates').show(new…
dortonway
  • 439
  • 1
  • 5
  • 17
0
votes
1 answer

Marionette CollectionView wrapped in div

I'm building html tables dynamically depending on the data with Marionette CollectionViews and ItemViews. The structure of the data looks like: var itemData = [ { row: "row 1", items: [ { item: "row 1, item 1" }, …
Mark
  • 4,428
  • 14
  • 60
  • 116
0
votes
2 answers

Internet Explorer string comparison

This function is working correctly in Firefox but not IE 11. I believe the culprit is: event = String(data.model.attributes.eventToRaise); I know through a bunch of logging (which I removed for presentation here) that I'm getting into the first…
Nathan Spears
  • 1,657
  • 8
  • 23
  • 31
0
votes
1 answer

Why am I getting uncaught reference error with this Backbone Marionette code?

I was going thru a Backbone Marionette tutorial....Everything was going well until I started adding code to instantiate a collection with a model. I'm using Marionette 2.4.2 and Backbone 1.2.1. Here is what I get in Chrome console: Uncaught…
Nona
  • 5,302
  • 7
  • 41
  • 79
0
votes
1 answer

Hiding buttons in a Marionette ItemView

I have a MarionetteJS application that utilizes a CompositeView to show a table of data. What I'd like to do is hide the "Remove" button from all of the ItemViews based on whether a related model is in a specific state. I can do this easily with…
Matt Koch
  • 181
  • 3
  • 14
0
votes
1 answer

Creating Backbone Marionette Carousel View

I want to know the better way create a Backbone Marionette Carousel View. Right now I have a collection view that renders all the views and I show/hide each view when the user clicks next and previous buttons. But is this the best way of doing? Is…
0
votes
2 answers

Display collection length in a view in Marionette.js

I'm learning Marionette.js and have a scenario, where my app has: app.addRegions({ main: '#omen', newItem: '#addnewitem', counter: '#counter' }); These regions. I have these Model/Collections: var Item = Backbone.Model.extend(), Items =…
Such Much Code
  • 787
  • 1
  • 9
  • 26
0
votes
1 answer

Backbone model not sending data on SAVE

This is the way I'm populating the attribute of my model: this.model.set('questionAnswers', arrQuestions); Now on submit, I check if model is valid: if (this.model.isValid()) { this.model.save(null, { success:…
Abhishek
  • 1,974
  • 5
  • 31
  • 67
0
votes
0 answers

how to show multiple composite view in single view backbone marionette js

I want to call multiple composite view in single view plz help me. var view = new applic({ collection: {collection1:CollectionList,collectionList2:CollectionList2}, model: new Model(data) });
vrushali
  • 19
  • 1
  • 4
0
votes
1 answer

Extending Parse.User

I am trying to extend the Parse.User object and am having issues when calling base object methods namely, login. So I have the following code: main.models.User = Parse.User.extend({ className : 'User', defaults : { objectId : false, …
Red2678
  • 3,177
  • 2
  • 29
  • 43
0
votes
1 answer

Is there a way to remove the extra wrapping div around a CollectionView in Marionette js 2.x?

I see ways to remove from ItemViews and Layouts but not the CollectionView. Override attachHTML? Using the CollectionView's tagName property to target an element won't work for me because I need the collection items to render directly into an…
Robert
  • 828
  • 2
  • 13
  • 28
0
votes
3 answers

marionettejs attachhtml ie8 - unexpected call to method or property

I'm testing my site in IE8. I'm using MarionetteJS and I have views dynamically added to the page. My page breaks in the marionette.js code on this line: this.el.appendChild(view.el); Can anyone point me in the right direction on how to fix this?…
SoluableNonagon
  • 11,541
  • 11
  • 53
  • 98