marionette

Detect click on itemview container in Backbone/Marionette

两盒软妹~` 提交于 2019-12-07 05:18:55
问题 I have the following item view: return Marionette.ItemView.extend({ template:tpl, tagName: 'div', className: 'v_itv_record_type_item', events:{ 'click @ui.item':'itemClicked' }, ui:{ item:'.v_itv_record_type_item' }, itemClicked:function(e){ console.log('clicked'); } }); that uses the following handlebars template: <div class="clicktarget"> Stuff Goes Here </div> If you click on one of these item views, it does not register the click event. I understand that Backbone restricts access to just

How to remove an Item from Selectize

♀尐吖头ヾ 提交于 2019-12-07 02:40:01
问题 Is there any Way i can remove an item from selectize AMNT QTY NA when i pass NA it should remove particular item $.fn.removeSelectorValue = function (value) { var selectize = this[0].selectize; selectize.removeItem(value) return this; }; this is not working.. Can anyone help me out from this??? 回答1: removeItem removes selected item identified by given value. To remove option from the list you should use removeOption Example - open http://brianreavis.github.io/selectize.js/, open console and

Marionette, backbone js betting game

杀马特。学长 韩版系。学妹 提交于 2019-12-06 15:44:16
This is a betting game, made in backbone. I have a bounty of 100 to help me refactor it into a marionette based application. I am unsure where to start - in terms of reconfiguring the models, how to swap the views out to make them regions. I believe the steps would be to start with creating a new marionette application and router. var app = Marionette.Application.extend({ initialize: function(options) { console.log('My container:', options.container); } }); var app = new app({container: '#app'}); //router var MyRouter = Marionette.AppRouter.extend({ appRoutes: { "some/route": "someMethod" },

Maintain a stack of Marionette ItemViews within a Marionette Layout

↘锁芯ラ 提交于 2019-12-06 14:05:28
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 displays an ItemView called A, then a click somewhere allows to switch to ItemView B. At this point, an

how to write marionettejs module using typescript?

不羁的心 提交于 2019-12-06 13:47:32
I'm trying to write MarionetteJS module using Typescript. Compiled module should be added to plain javascript application using RequireJS and initialized as normal Marionette module i.e.: define( ['marionette', 'modules/sample/sample'], function (Marionette, Sample) { var sampleApp = new Backbone.Marionette.Application(); sampleApp.SampleModule = sampleApp.module("SampleModule", Sample.Sample); } My module is created, but initializer and start functions are not being called by Marionette.Appplication. This is my TypeScript class: /// <amd-dependency path="backbone" /> /// <amd-dependency path=

Marionette + i18n in templates

。_饼干妹妹 提交于 2019-12-06 13:44:55
问题 I want to do some basic i18n in my application I loaded the i18n plugin (from require.js) to my Application and created a directory nls in which i have several files e.g. project.js I set up the default location in main.js file like config : { i18n : { locale : 'de-de' } } I now want to use the files in my View / Template. Can somebody explain to me how this is done? The templates are setup in one template.js file My View: define(['marionette', 'templates', 'i18n!nls/project'], function

How to integrate Handlebars template to Marionette View?

旧时模样 提交于 2019-12-06 12:51:18
问题 In my app, I am using the handlebars template plugin, I am little bit confused here, how can i integrate handlebars template to marionette Item View which is using separate template? here is my code : define([ 'jquery', 'underscore', 'backbone', 'marionette', 'hbs!scripts/templates/login/loginTemp'], // this is my handlebars template. function ($,_,Backbone,Marionette,loginTemplate) { "use strict"; socialApp = window.socialApp || {}; socialApp.loginView = Backbone.Marionette.ItemView.extend({

MarionetteJS: Using a collection with two or more views for different layouts

此生再无相见时 提交于 2019-12-06 06:22:05
I have a UI controller that for simplicity you can think as a Folder Tree where you can select multiple folders with checkboxes. The selection is saved in the model and "on save" there rare also a few actions triggered. For usability reasons, we want to use two different visualizations of the same controller. The two UI controllers can in some layouts be present at the same time, in others only one at the time. It would be nice to be able to reuse the same collection instance across the 2 UI controllers. I can do this in one module pretty easily but how should I structure the code to make it

Marionette.Renderer, Underscore templates and internationalization with i18next

大兔子大兔子 提交于 2019-12-06 02:07:52
问题 We are currently in the need of adding internationalization to a medium sized app using Backbone.Marionette and underscore templates. After some thorough research, two valid options are emerging : underi18n which provides direct integration with underscore, but lacks pluralization, which becomes essential for supporting more than french and english i18next which provides a powerful API but only direct integration with handlebars templates We will need on a longer term to localize in many more

Backbone Marionette Event Aggregator : how to listen at the App level to ItemView Event

僤鯓⒐⒋嵵緔 提交于 2019-12-05 11:42:28
I'm new to Marionette and can't get my head around events... I have an ItemView which trigger an event, and I would like to receive this event at the application level, but when my app listen for this event, nothing happens... If the Event Aggregator is in Application and ItemView, why this code doesn't work ? : var MessageItemView = Backbone.Marionette.ItemView.extend({ template: "#messagesTPL", tagName: 'tr', className: 'messageItem', events : { 'click': 'displayMessage' }, displayMessage: function () { this.trigger('display:message'); } }); App.on('display:message', function () { console