Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone Marionette, Composite View initializes twice
    primarykey
    data
    text
    <p>I'm using a composite view that has $.dialog called on it's $el.</p> <p>The composite view is then listing items from a collection.</p> <p>Now i've tried multiple ways to render the collection items: fetching from outside the composite view before and after attaching it to the view, fetching inside the view, preloading the collection from my server script, etc...</p> <p>all seem to work but the same problem occurs..</p> <p>as soon as the composite view see's this collection, it calls it's own initialize function again... </p> <p>I fully understand that the render function will be called on a collection reset or add... but the initialize??? i have absolutely no idea why this is happening.</p> <pre><code>showCustomFieldSelect: function(e){ log('triggered'); e.preventDefault(); var cl = new AustApp.Collections.CustomField; var select = new AustApp.Views.AvailableCustomFieldsList({ el: "#available-custom-fields-popup", collection: cl }); cl.fetch(); cl.once("reset", function(){ // this bind was // previously used for creating the view // or calling render functions directly // amongst numerous efforts to debug }, this); }, MyApp.Views.AvailableCustomFieldsList = function(){ var AvailableCustomFieldsList = Backbone.Marionette.CompositeView.extend({ template: "#available-contact-list-custom-field-list-js", tag: "div", itemView: AustApp.Views.AvailableCustomFieldsListItem, emptyView: AustApp.Views.EmptyAvailableCustomFieldsListItem, itemViewContainer: "ul", templateHelpers: viewHelpers, initialize: function(){ log('init called'); // called twice????? this.render(); this.$el.dialog({ title: "Available Custom Fields", width: '600px', modal: true, dialogClass: "round", }); }, /* stuff */ }); return AvailableCustomFieldsList; }(); </code></pre> <p>Any help appreciated as I'm flummoxed </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload