Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9158667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:18:09+00:00 2026-06-17T13:18:09+00:00

I have a backbone.marionette application that is using a CollectionView to output the following:

  • 0

I have a backbone.marionette application that is using a CollectionView to output the following:

  • div#main .widget
    • div.head
    • div.body

Here are the 2 sibling ItemViews:

var LogLocationBodyView = App.ItemView.extend({
    tagName: "div",
    attributes: {class: "body"},
    template: "#log-location-body-template"
});

var LogLocationHeadView = App.ItemView.extend({
    tagName: "div",
    attributes: {class: "head"},
    template: "#log-location-head-template" 
});

And here is the CollectionView:

var LogLocationsView = App.CollectionView.extend({
    template: "#log-locations-template",
    attributes: {id: "main", class: "widget"},
    itemView: LogLocationHeadView
});

I can obviously get LogLocationHeadView to render but I’m looking for the best approach to inserAfter() LogLocationBodyView, so that the 2 ItemViews are siblings.

What is the best way to pull this off? I’ve tried a number of different approaches. First I tried to use the onRender() of my ItemView, but quickly realized I could only append to the markup in the view. I really need to insertAfter() and parent is unavailable since within onRender we are still pre-DOM insertion.

var LogLocationHeadView = App.ItemView.extend({
    tagName: "div",
    attributes: {class: "head"},
    template: "#log-location-head-template",
    onRender: function() {

        // create a new piece of html from a different template
        var view = new LogLocationBodyView({
            model: this.model
        });

        view.render();

        $(this.el).append(view.el);

        var c = $(this.el).children();
            console.log(c); // true

        var p = $(this.el).parents();
            console.log(p); //undefined

    }

I also understand I can override the appendHTML() and renderItem() methods within CollectionViews, but I need to still be able to append(). So I would need to be able to pass a renderType.

What I really would like to do is pass an array of ItemViews along with a renderType to renderItem. Then, renderItems could fork within appendHTML().

var LogLocationsView = App.CollectionView.extend({
    template: "#log-locations-template",
    attributes: {id: "main", class: "widget"},
    itemViews: [{view: LogLocationHeadView, renderType: append}, {view: LogLocationBodyView, renderType: insertAfter}]
});

Before I try to do that, Id like to see if I am completely off base here. Is there a better way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:18:10+00:00Added an answer on June 17, 2026 at 1:18 pm

    This was answered awhile back starting here: https://github.com/marionettejs/backbone.marionette/issues/36.
    and here:
    https://github.com/marionettejs/backbone.marionette/issues/35

    Now it is a full feature :

    http://lostechies.com/derickbailey/2012/04/05/composite-views-tree-structures-tables-and-more/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to build a pretty complex application using Backbone Marionette. The user interface
In my backbone.Marionette application I have a Model that requires an Id attribute to
I have a Backbone.js application that allows users to create graphs based on large
I have a collection ( using the Backbone.paginator ) that fetchs a array of
I have Backbone App Here are codes : This is Main.coffee : require [App/app,backbone]
I have complex backbone application with many nested views ( marionette layouts and regions
I have this code in Coffeescript window.App = new Backbone.Marionette.Application Models: {} Collections: {}
Currently using a setup that follows: Backbone , Parse , Require , and Marionette
I have built a web app using backbone.marionette . When, from a Marionette.ItemView ,
I have an application in rails 3 using backbone.js When I use @model.save, i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.