marionette

Passing value from Marionette to aspx

旧时模样 提交于 2019-12-13 06:32:10
问题 I am new to Marionette but progressing day by day, I am in a situation where i have calculated value on Marionette.js file and i need to pass that value back to aspx, value is css height value, am attaching my code pic and let me know what i am doing wrong, even passing hardcoded value from .js file it is not getting that value in UI. 来源: https://stackoverflow.com/questions/31578113/passing-value-from-marionette-to-aspx

Marionette drop in new ItemView after every fetch not working

微笑、不失礼 提交于 2019-12-13 06:00:19
问题 I am working with an app that after every collection.fetch , I need to drop in a random ad into the DOM. But, every time the collection fetches, and the ad is dropped in, it appears that the DOM is resetting itself instead of just appending new items to the overall collection container. Here is the ItemView for the ad: define(["marionette", "lodash", "text!ads/template.html", "eventer"], function(Marionette, _, templateHTML, eventer) { 'use strict'; var AdsView = Marionette.ItemView.extend({

Events between Marionette.CompositeView and Marionette.ItemView

て烟熏妆下的殇ゞ 提交于 2019-12-13 05:55:09
问题 I have two modules itemView.js and ListView.js . Everything works when I fetch the data. The problem is about the item view (1) when I change the corresponding model. a) the ListView.js (2) displays all the object which models have closed value equal to false (3) b) the action closeTask in (1) changes the value of the model from closed: false to closed: true c) when b) occurs nothing change, but if I reload the page I get the right results (the model having the closed value equal to true is

How to construct template for Composite view Dynamically

孤街醉人 提交于 2019-12-13 04:13:49
问题 Desired output : <script id="table-template" type="text/html"> <table> <thead> ADD THE HEADER NAMES HERE DYNAMICALLY, </thead> <!-- insert collection items --> <tbody></tbody> </table> </script> I am trying to get the above template generated, the problem here is the header names Portfolio Amount Exchange Amount in Fccy Quantity Account like the above it would be the fixed one, the user can give any number of header names. This is the Code i have done : Grid.Hexgrid = Backbone.Marionette

Using jquery on Marionette itemView to addClass to this.$el

孤街醉人 提交于 2019-12-13 02:12:27
问题 I'm trying to add a class to the enclosing tag of an itemView when a model is changed as follows View.Option = Marionette.ItemView.extend({ tagName: "li", className: "option-item clearfix", template: optionsItemTpl, modelEvents: { "change": "modelChanged" }, modelChanged: function() { console.log(this.$el); this.$el.addClass('success'); } }); The follow outputs the element I'm trying to add the class to console.log(this.$el); but the class isn't added and I just can't see why this would be.

Switching from a region to another in Marionette, views are not rendered correctly

白昼怎懂夜的黑 提交于 2019-12-12 21:06:26
问题 I'm working with Marionette and I have the following problem. I've created a layout with two different regions. On initialize the layout loads two views in two regions of my layout. Say ViewA and ViewB . Within ViewA an event is triggered. The event is consumed by the layout to switch and other two views are injected. Say ViewC and ViewD . Whenever the switching is performed, ViewC and ViewD do not have the same style (also the css) that I applied to them. In particular, jQuery Mobile styles

Updating a LayoutView's Model

北城以北 提交于 2019-12-12 18:23:33
问题 JSBin link Click the 'Clicks' link to see the console showing updated model data, but the original displayed HTML doesn't change. Updating the model on the LayoutView doesn't seem to cause the view to update the displayed data. I thought that was part of the default interaction between Views and Models. 回答1: Backbone and Marionette do not bind model data to views automatically. You will have to listen that model to change within the view and update it. For example, you can simply re-render

Backbone.Marionette Change Region when Route changes

孤者浪人 提交于 2019-12-12 13:28:59
问题 My app has a main region and some times there will be sub regions in the main region that should be accessible by an URL. The main region content is changed by a function the app router cause he knows the main region. But whats about the temporary regions in sub views? So for example the url /docs will show a list of links to documents and /doc/:id should show the content of the doc beside the list. So how can /doc/:id could render the content when some one click on the list and render both

In backbone marionette is there a way to tell if a view is already shown in a region?

流过昼夜 提交于 2019-12-12 10:48:01
问题 Given something like this: View = Backbone.Marionette.ItemView.extend({ }); myView = new View(); //region already exists myLayout.region.show(myView) //some time later this gets called again: myLayout.region.show(myView) I can see currentView in the docs but this only seems to apply at initialisation. Once a view is shown can I query the region to see the view? Either the view instance or type would be helpful. Looking in Chrome's debugger I can't see any properties/methods on the region that

Backbone Marionette different composite views

▼魔方 西西 提交于 2019-12-12 09:54:43
问题 Is it possible to have a composite view in marionette with DIFFERENT item views inside? For example: var myCompositeView = Backbone.Marionette.CompositeView.extend({ template: Handlebars.compile(myTemplate), itemView: myView, // I want different views, not just myView initialize: function(){ this.collection = this.model.views; }, appendHtml: function(collectionView, itemView){ collectionView.$('.container').append(itemView.el); } }); Basically, depending on the model in the collection, I want