marionette

Example of marionette.js layout/region structure and rendering method

假如想象 提交于 2019-12-10 18:21:30
问题 I'm trying marionette.js for my backbone application but I'm a bit baffled as to how I should organize my layouts/regions and render them. I'm looking for an example application with nested layouts and regions so I could understand a bit better. Any advice ? 回答1: Check out this fiddles: http://jsfiddle.net/tegon/0g2aaLxe/1/ http://jsfiddle.net/tegon/64ovLf64/ for general backbone marionette boilerplate starting point check this: https://stackoverflow.com/questions/11410059/suggested-bootstrap

CompositeView slow to render items for large result set Marionette

删除回忆录丶 提交于 2019-12-10 17:22:30
问题 I'm currently working on a project that's using .NET MVC on the back end and Backbone (v1.1) with Marionette JS (v1.8.5) on the front end and I am experiencing some performance issues when trying to render a Composite view with 200 results or item views. I first came across this SO post of a similar issue which helped me get a newer version of marionette (v1.8.5). Handlebars templates are being used to show a html table with each itemView being wrapped in a tbody (this has a more complex

How to use MarionetteJS to consume Api calls.

喜夏-厌秋 提交于 2019-12-10 16:33:09
问题 How do you only use parts of API call that you want in Marionette.js Using code below: /messages returns JSON: messages.foo messages.read messages.friend messages.following How can I create three different view for 3 different regions using Marionette View model based on one fetch. (It would be nice to have read/unread in one view) var MessageModel = Backbone.Model.extend({ urlRoot: '/messages', }); var MessageCollection = Backbone.Collection.extend({ url: '/messages', model: MessageModel, })

Select2 acts very different with Uncaught query function not defined for Select2 <select2-id>

那年仲夏 提交于 2019-12-10 14:57:08
问题 I load values for select2 like the following way. Declare the Type var AdjustmentType = Backbone.Model.extend({ url : Hexgen.getContextPath("/referencedata/adjustmenttype") }); create instance for the Type var adjustmentTypes = new AdjustmentType(); load the values to select2 box adjustmentTypes.fetch({ success : function() { for(var count in adjustmentTypes.attributes) { $("#adjustment-type").append("<option>" + adjustmentTypes.attributes[count] + "</option>"); } } }); $("#adjustment-type")

Backbone.js `model.destroy()` custom transitions?

假装没事ソ 提交于 2019-12-10 13:26:22
问题 When I use Backbone's model.destroy() , it seems to automatically remove that view from the DOM. Is there a way for me to use destroy() to send the DELETE request, but remove the view from the DOM myself? Something like: this.model.destroy({ wait: true, success: function(){ $('#myElement').animate({ "height" : "0", 1000, function(){$('#myElement').remove()} }); } }); 回答1: You need to override _onCollectionRemove() in whichever Collection view contains the item views (documentation). This is

How to render view with Backbone Marionette

╄→гoц情女王★ 提交于 2019-12-10 12:13:34
问题 I'm using Backbone.Marionette and need to render a view of employees and their respective departments. I want it to look something like so: Department 1 *** Employee1 Employee2 Employee3 Department 2 *** Employee4 Employee5 Employee6 Employee7 Employee8 Department 3 *** Employee9 Employee10 My collection looks like this: Employee1 / Department1 Employee2 / Department1 Employee3 / Department1 Employee4 / Department2 Employee5 / Department2 etc. As the department changes I need to render the

Maintain a stack of Marionette ItemViews within a Marionette Layout

筅森魡賤 提交于 2019-12-10 11:19:59
问题 I would like to know if it possible to extend in some way the mechanism Marionette Layout s are based on creating a sort of stack like navigation. Marionette behaviour. Before a region show() 's a view it calls close() on the currently displayed view. close() acts as the view 's destructor, unbinding all events, rendering it useless and allowing the garbage collector to dispose of it. My scenario. Suppose I have a sort of navigation mechanism where a Layout acts as controller and first

Backbone Routes - trigger route on page load

て烟熏妆下的殇ゞ 提交于 2019-12-10 11:18:39
问题 This is a simple question, but I am new to routing and haven't been able to find an answer to this. I have a Marionette Router (if I intimidate you, its really the same thing as a Backbone Router. Very simple). sys.routes = { "app/:id": "onAppRoute", }; sys.Router = new Marionette.AppRouter({ controller: { onAppRoute: function(route) { console.log('Called app route!'); }, }, appRoutes: sys.routes, }); Backbone.history.start({pushState: true}) This works - if you hit the back button my browser

Display a view using an existing rendered HTML with Backbone Marionette

随声附和 提交于 2019-12-10 09:24:10
问题 I am having an application layout like the one attached. The upper panel is already to the page (i.e. in the server's HTML response). While the user interacts with the elements in that panel the content of the dynamic panel below changes accordingly. I've studied Backbone Marionette various View types and Region Manager. But I still can't figure out a way to implement this. I need to capture events from the already rendered elements and change the dynamic content accordingly. As I understand,

Backbone Marionette: Marionette.Application causing Require.js module load error, “'Error: Module name 'App' has not been loaded yet for context: _”

为君一笑 提交于 2019-12-10 00:12:23
问题 I'm trying to include the App instance to use it's event aggregator as shown here I get an error when I include the instance in a view. Kicking things off in the Requirejs config file, from App.Bootloader.js: require(['App'], function (App){ App.start(); }); from App.js: define(function (require){ //...requisite includes $, _, Backbone, Marionette ... var Layout = require('Layout'); var App = new Marionette.Application(); App.addRegions({ main: '#view_content' }); App.addInitializer(function