marionette

Using Marionette.ItemView for views without models?

放肆的年华 提交于 2019-12-03 09:30:26
问题 Is it conventional to use Marionette.ItemView for view classes that do not have a specific model property associated with them? As Marionette.View is not meant to be used directly, it seems like an ItemView makes sense as a view class with convenient defaults and bindings. Or, should one just resort to using Backbone.View ? If so, is there a way to hook Backbone.View into Marionette's evented and garbage-collected architecture? Thank you for clarification! 回答1: ItemView can be used without a

Marionette.CompositeView, how to pass parameters to Marionette.ItemView

左心房为你撑大大i 提交于 2019-12-03 09:27:17
问题 I would like to access the app.vent from Marionette.ItemView. Maybe an option could be to pass a parameter ( app.vent ) to Marionette.ItemView from Marionette.CompositeView . Here my code: // view/compositeView.js define([ 'marionette', 'views/item' ], function (Marionette, itemView) { var ListView = Marionette.CompositeView.extend({ itemView: itemView }); }); Any ideas? P.S.: I cannot access the app from itemView because there is a problem of circular dependency. app -> view/compositeView ->

How to synchronise/organise modules using requirejs and Backbone.Marionette

本秂侑毒 提交于 2019-12-03 09:07:12
I organised the file structure of my web app, which is using RequireJs and Backbone.Marionette ,in this way: |- main.js |- app.js |- /subapp1 |- subapp1.js |- subapp1.router.js |- /subapp2 |- subapp2.js |- subapp2.router.js |- /colections |- /views To loads the modules I use requireJs. Here's my code, for each module I put some questions. // main.js define([ 'app', 'subapp1/subapp1.router', 'subapp2/subapp2.router' ], function (app) { "use strict"; app.start(); }); Questions: 1) Is right to load asynchronously the app and subapps even if subapps need app? 2) for the subApps is right to load

Marionette bubble event from itemview to parent layoutview?

╄→尐↘猪︶ㄣ 提交于 2019-12-03 07:33:25
I have a layout view with a region, in that region I have a item view that triggers an event but it doesn't seem to be bubbled up to the layout view. Am I doing something wrong or is this designed behavior? I assume the itemview prefix is not added as the parent view is not a collection view? Either way the event is never bubbled to the layout view. layoutView = Marionette.Layout.extend({ template: "#layout-template", regions: { titleRegion: "#job-title-region" }, triggers: { "save:clicked" : "onSaveClicked" }, onSaveClicked: function (args) { alert('Clicked'); } }); childview = Marionette

How to add a custom delete option for backgrid rows

左心房为你撑大大i 提交于 2019-12-03 06:07:22
i have developed editable grid using backgrid and it looks good also. following is my output : when i select the check box and click on delete icon, then the selected rows are deleted. now i also would like to have the delete option on each row so that the user can delete the row directly. How to put delete icon on each row.?? You can make a custom cell. var DeleteCell = Backgrid.Cell.extend({ template: _.template(" PUT YOUR HTML BUTTON TEMPLATE HERE "), events: { "click": "deleteRow" }, deleteRow: function (e) { e.preventDefault(); this.model.collection.remove(this.model); }, render: function

backbone.marionette + i18n + handlebars

佐手、 提交于 2019-12-03 05:25:52
问题 Can some one post an example of combining these libraries together? including the handler for the i18n and marionette. Thanks 回答1: point backbone.marionette templates to compile hendlebars. this can be done on your main.js: Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) { return Handlebars.compile(rawTemplate); }; configure your app to use handlebars and i18n: this can be done on your config.js: require.config({ // Initialize the application with the main

How to use Backbone.Marionette.ItemView with Mustache

只谈情不闲聊 提交于 2019-12-03 05:19:35
问题 The following code works fine using Backbone.Marionette.ItemView but not Mustache . Backbone.Marionette.ItemView - no Mustache I would like to use the same code but loading the template varaible using Mustache . Here is my code: Backbone.Marionette.ItemView - with Mustache Any idea why my code does not work and why? Thanks 回答1: Marionette assumes the use of UnderscoreJS templates by default. Simply replacing the template configuration for a view isn't enough. You also need to replace how the

Can't seem to cleanup detached DOM elements

好久不见. 提交于 2019-12-03 05:08:34
问题 I'm using jquery-ui Tabs and I'm having a problem that occurs when a tab has been removed. The tab appears to be removed, along with its content div but when you take a look at the heap in Chrome DevTools Profiles (after a tab has been removed) you'll see that the tab li and div elements are still present, but detached. Over time, the repeated addition/removal of tabs causes these elements to accumulate. For example, if you add a tab 10 times, there will be 10 detached div elements and 10

Routing in Backbone.js / Marionette.js - no hashtags, route list and sub-routers

五迷三道 提交于 2019-12-03 03:50:30
I have three questions about routing in Backbone.js / Marionette.js : 1) How can I get a list of all the routes my application's routers have registered ? For example for Express.js (in Node.js) it would be app.routes . I'm trying to do the same with Backbone.js / Marionette.js but couldn't find any property or method that did this. 2) I want to clean-up my URLs and remove the hashtag "#" in front of them, I know that they trigger the Routers so how can I manage to do this ? I found the following script that prototypes the Backbone router, but it's more of a hack than a stable solution :

How to define/use several routings using backbone and requirejs

天大地大妈咪最大 提交于 2019-12-03 03:19:48
I divided my app in several apps. main.js app.js app1/ |- routing |- controller |- app app2/ |- routing |- controller |- app 1) When I try to use the routers in app1 , they work. 2) When I try to use the routers in app2 , they don't work. 3) If I comment the line 'js/app1/routing', in main.js the routers in app2 work. Why do I get this behaviour? Is there some example of app using multiple routing and requirejs on github? thanks. Here's my code: ** main.js ** define([ 'js/app', 'js/app1/routing', // the routers in this app work 'js/app2/routing' // the routers in this app do not work but // if