marionette

Backbone Marionette Composite View Rendering Template

℡╲_俬逩灬. 提交于 2019-12-25 16:46:34
问题 I'm trying to render a list with a Marionette CompositeView. I am not sure why the rendered list just has an item displaying the word result . I was expecting the first item to display Level 1 . Here is a fiddle to my current code: http://jsfiddle.net/16L1hen4/ Here is my JS, template, and data: JavaScript: var App = new Backbone.Marionette.Application(); App.addRegions({ mainRegion: '#main' }); var TreeModel = Backbone.Model.extend({ }); var TreeCollection = Backbone.Collection.extend({

How to render a collection of different Marionette Views

ⅰ亾dé卋堺 提交于 2019-12-25 16:36:24
问题 I am trying to render a backbone collection of views. The collection could be any kind of marionette view ( layoutView, CompositeView, collectionView, ItemView). When I try and render, I get “[object Object]” for each view that renders. This leads me to believe that it doesn't know which view to render when it grabs one from the collection. I have now started using getChildView() in the CollectionView that is suppose to render the collection of Views but I am unsure how to specify the type of

Event handling in nested compositeView

丶灬走出姿态 提交于 2019-12-25 14:09:10
问题 I am using the same structure as explained in the answers for this question -- > How to handle nested CompositeView using Backbone.Marionette? to render my composite views and Item view. My Item view consists of LI tag. I want to handle click event for this Itemview. I am trying my code as below : which is not working The same events code snippet If I write in my first composite view, It get's triggered. But events do not get triggered in ItemView. Please help. var topNavMenuView = Backbone

Event handling in nested compositeView

情到浓时终转凉″ 提交于 2019-12-25 14:08:52
问题 I am using the same structure as explained in the answers for this question -- > How to handle nested CompositeView using Backbone.Marionette? to render my composite views and Item view. My Item view consists of LI tag. I want to handle click event for this Itemview. I am trying my code as below : which is not working The same events code snippet If I write in my first composite view, It get's triggered. But events do not get triggered in ItemView. Please help. var topNavMenuView = Backbone

Backbone Marionette and ICanHaz (Mustache) templates configuration

天涯浪子 提交于 2019-12-24 16:38:58
问题 I'm migrating a Backbone basic app to Marionette and I would like to use ICanHaz.js as a template system (based on Mustache). I'm using AMD and Require.js and the only way to make ICanHaz.js working with it and Backbone was to use jvashishtha's version. I first implemented the app in pure Backbone style. In particular I used to load each template as raw strings with the Require.js' text plugin and then add the template to the ich object. This create a method in ich object that has the same

Prevent Marionette view from close onBeforeClose

空扰寡人 提交于 2019-12-24 06:38:52
问题 I'm trying to prevent the user from making an edit to a model via form and easily navigating away from that change. Think Gmail when you've started composing a message. Someone has posted an issue on GitHub that describes the same situation. https://github.com/marionettejs/backbone.marionette/issues/186 This issue was closed because people suggest you should detect changes before attempting to close a view. But the problem with this approach is there there are several ways a view can be

External handlebars templates backbone marionette

こ雲淡風輕ζ 提交于 2019-12-23 15:42:15
问题 In my application i added Marionette.sync plugin and override these methods: Backbone.Marionette.TemplateCache.prototype.loadTemplate = function (templateId, callback) { var tmpId = templateId.replace("#", ""), url = "/app/templates/" + tmpId + ".html"; $.get(url, function (templateHtml) { compiledTemplate = Handlebars.compile($(templateHtml).html()) callback.call(this, compiledTemplate); }); }; Backbone.Marionette.Renderer.renderTemplate = function (template, data) { template(data); }; But

Backgrid integration

人盡茶涼 提交于 2019-12-23 12:20:11
问题 How I would use backgrid within a backbone.marionette application? 回答1: It's as simple as it looks. Just add the Backgrid view to any region: MyApp.addRegions({ someRegion: "#some-div" }); var columns .... var userList .... MyApp.someRegion.show( new Backgrid.Grid({ columns : columns, collection : userList }) ); 来源: https://stackoverflow.com/questions/14790906/backgrid-integration

Undefined model prototype in Backbone Collection and Marionette CompositeView

笑着哭i 提交于 2019-12-23 07:46:07
问题 Trying to populate a Collection from a list of values, I am getting an error about the Collection's model 's prototype being undefined. Looking at this question about a similar problem, I have checked that the Model is actually created before the collection is instanced, to the best of my ability. The error is being thrown in one of the event handlers of the Marionette CompositeView that holds the Collection, after fetching the data from the server and trying to reset the collection with the

Backbone.Marionette - passing variable to composite view tag

左心房为你撑大大i 提交于 2019-12-23 04:51:34
问题 UPDATE (RELEVANT DETAIL): This composite view is within a collection of composite views. How can I construct the following HTML using a Backbone.Marionette composite view? <optgroup label="Group 1"> <option>Item 1</option> <option>Item 2</option> <option>Item 3</option> </optgroup> <optgroup label="Group 2"> <option>Item 4</option> <option>Item 5</option> <option>Item 6</option> </optgroup> Since I want to avoid the <div> wrapper, I will have to specify <optgroup> as the tagName. view =