marionette

How to prevent Backbone.Marionette from rendering a view if it's model hasn't been fetched?

两盒软妹~` 提交于 2019-11-30 08:48:10
In my backbone.Marionette application I have a Model that requires an Id attribute to construct it's url. I therefore create the model by passing it an Id, add it to a view and then fetch the model: model = new Model({_id:id}) view = new View({model:model}) app.content.show(view) model.fetch() I would expect the view to only start rendering once the model has been fetched, but Marionette renders the model immediately causing my template rendering to fail as the expected attributes don't exist. Any workarounds? I'm trying to do something similar to the accepted answer here: Binding a Backbone

How to handle nested CompositeView using Backbone.Marionette?

我的未来我决定 提交于 2019-11-30 02:16:08
I'm getting into larger-scale data structures with Backbone, and coming across occasions where data would be well-represented via CompositeViews; that is, CollectionViews with the addition of "added fluff" around them, such as headers, buttons, and so on. However, I'm having a lot of difficulty nesting CompositeViews inside one another. Using the standard itemView property on a CompositeView to render another CompositeView doesn't seem to be firing at all. Assume I have a parent ItemView , instantiated as such (following Derick Bailey's example ; assume this top level is where the initial

Binding a Backbone Model to a Marionette ItemView - blocking .fetch()?

≯℡__Kan透↙ 提交于 2019-11-29 22:39:33
This is a 2 part question. 1) Is there a better way to render a model to a view asynchronously? I'm currently making the ajax request using the fetch method in the model (though I'm calling it explicitly upon initilization), then rendering the templated view using an application event, vent , which gets published from inside the model after the parse method is called. Cool but wonky? 2) Would a blocking fetch method be of use, and is it possible? The application renders this to the page: layout navbar index Then it fetches the model and renders this: layout navbar thing 1 something

Integrating iCanHaz and Marionette

前提是你 提交于 2019-11-29 12:58:24
I'm a big fan of ICanHaz, and I'm trying to directly intregrate it into a new Marionette application I'm building. However, going off this post , I have written this that reaches into the render method and changes it in Marionette: // Set up Initalizer APP.addInitializer(function() { //Reach into Marionette and switch out templating system to ICH Backbone.Marionette.Renderer.render = function(template, data){ return ich[template](data); } //Create Router new APP.Routers.GlobalRouter(); //Start Backbone History Backbone.history.start(); }); If I walk through this function, all the data seems to

How to prevent Backbone.Marionette from rendering a view if it's model hasn't been fetched?

倾然丶 夕夏残阳落幕 提交于 2019-11-29 12:32:01
问题 In my backbone.Marionette application I have a Model that requires an Id attribute to construct it's url. I therefore create the model by passing it an Id, add it to a view and then fetch the model: model = new Model({_id:id}) view = new View({model:model}) app.content.show(view) model.fetch() I would expect the view to only start rendering once the model has been fetched, but Marionette renders the model immediately causing my template rendering to fail as the expected attributes don't exist

What to use since Marionette Application Regions are deprecated

一个人想着一个人 提交于 2019-11-29 11:58:16
问题 I am confused by the Marionette (2.3.0) documentation from the link below that says the Application Regions feature is deprecated. A Layout View should be used instead. Does that mean I should not use MyApp.addRegions() any more? Then how should I add my Layout View to my application? http://marionettejs.com/docs/marionette.application.html#application-regions Application Regions Warning: deprecated This feature is deprecated. Instead of using the Application as the root of your view tree,

Call a function in another Marionette.ItemView

纵饮孤独 提交于 2019-11-29 08:50:00
I have one ItemView, where I use clearSearch() function. I need to call the same function in another ItemView, so to keep it DRY I tried to call clearSearch(), but i didn't work. View.Panel = Marionette.ItemView.extend({ template: panelTpl, events: { 'click .search_clear': 'clearSearch', } clearSearch: function() { //some important actions } }); View.Pagination = Marionette.ItemView.extend({ template: paginationTpl, events: { 'click .page': 'changePage' }, changePage: function(e) { //others important actions clearSearch(); } }); I also tried to use View.Panel.clearSearch() , but I've got this

Nesting Marionette regions, layouts and views

久未见 提交于 2019-11-29 04:10:20
I'm trying to get my Marionette views working in combination with application regions and layouts, but I just can't seem to get the nested views in the layout to render. Edit: I expected both the OptionsView and BreadcrumbsView to be rendered in the NavigationLayout , which should be rendered in the navigation region. However, the navigation region isn't rendered at all. The console doesn't show any errors. My structure is as follows: - Navigation region - Navigation layout - Options region - Breadcrumbs region - Content region Assigning an ItemView to the navigation region works as expected.

How to handle nested CompositeView using Backbone.Marionette?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 23:44:48
问题 I'm getting into larger-scale data structures with Backbone, and coming across occasions where data would be well-represented via CompositeViews; that is, CollectionViews with the addition of "added fluff" around them, such as headers, buttons, and so on. However, I'm having a lot of difficulty nesting CompositeViews inside one another. Using the standard itemView property on a CompositeView to render another CompositeView doesn't seem to be firing at all. Assume I have a parent ItemView ,

Nested collections with Backbone.Marionette

江枫思渺然 提交于 2019-11-28 19:51:12
I want to create a calendar which is a day collection, and every day is a collection of appointments. The structure of day object is: day:{ date:'08-06-2012', appointment: { time_begin:'12:55', time_end: '16:40', customer: 'Jaime' } } At this moment i have this models and views: // CALENDAR COLLECTION App.Calendar.Collection = Backbone.Collection.extend({ // MODEL model: App.Day.Model } When calendar collection fetch data form the server, it gets complete day objects including appointments. // CALENDAR VIEW App.Calendar.View = Backbone.Marionette.CompositeView.extend({ // TEMPLATE template: