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

  • Home
  • SEARCH
  • 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 8515127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:03:45+00:00 2026-06-11T05:03:45+00:00

I have an app which shows boxes within boxes. Each box model has a

  • 0

I have an app which shows boxes within boxes. Each box model has a method ‘children’ which returns any boxes that are shown within the box. What I want to do is click a button and have the children rendered as a table with their properties listed in several columns.

I’m not really sure how to do this. I think the Underscore template might look something like this:

<table class='list-items-template'>
          <tr>
          <td><%= this.model.ITSCHILDX.get('image') %>       </td>
          <td><%= this.model.ITSCHILDX.get('title') %>       </td>
          <td><%= this.model.ITSCHILDX.get('description') %> </td>
          </tr>
      </table>

But then within the Box view, I need some way of saying that each child should be inserted within the table and each of its attributes should be represented. Help is greatly appreciated.

  • 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-11T05:03:47+00:00Added an answer on June 11, 2026 at 5:03 am

    Not sure if I’m understanding the setup correctly but you have a BoxModel.

    BoxModel = Backbone.Model.extend({
        defaults: {
            'image':string,
            'title':string,
            'description':string
        }
    });
    

    And a BoxModel can contain children BoxModels?

    boxModel.children = new Collection(); // of box models?
    

    And you want to iterate through the children collection and represent each model as a table row?

    If this is what you want here is what I’d do. A box model is represented by a BoxView which is a table and its children are essentially represented as rows. So we define it as this:

    BoxView = Backbone.View.extend({
        tagName: 'table',
        className: 'list-items-template', // I just used this name to connect it with your ex.
                                          // I'd probably change it to like, box-table
        template: _.template('<tr>
            <td><%= image %>       </td>
            <td><%= title %>       </td>
            <td><%= description %> </td>
            </tr>'),
        initialize: function() {
            // Note: We've passed in a box model and a box model has a property called
            // children that is a collection of other box models
            this.box = this.model;
            this.collection = this.box.children // Important! Assumes collection exists.
        },
        render: function() {
            this.$el.html(this.addAllRows());
            return this;
        },
        addAllRows: function() {
            var that = this;
            var rows = '';
            this.collection.each(function(box) {
                rows += that.template(box.toJSON());
            });
            return rows;
        }
    });
    
    
    // This assumes that whatever BoxModel you have instantiated, it has a property called
    // children that is a collection of other BoxModels. We pass this in.
    
    // Get the party started
    var myBoxTable = new BoxView({
        'model': someBoxModel  // Your box model, it has a collection of children boxModels
    });
    
    // Throw it into your page wherever.
    $('#placeToInsert').html(myBoxTable.render.el());
    

    Also note, that this basically means your children boxModels are represented visually in this example. If each child (row) had to have some functionality, instead of just using the template to write out a visual representation, I’d use the addAllRows() method to instantiate a second type of BoxModel View. A view that is a table row and has more functionality like events delegated properly.

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

Sidebar

Related Questions

I have an app which has UITabBar with 5 views, each attached to a
Hi I have a gallery in my app which shows the image in an
I have an app which contain some images in res/drawable/ and shows them in
I have app in which i have recorded sound files i want that i
I have an app which has a map and some POI on it. I'm
i have an app which shows the received messages as a Toast through a
SETUP : I have this app which has 4 activities in a linear path,
I have an app that has a UINavigationController that pushes a UITabBarController into view.
I have an app which shows html files from assets folder. I would like
I have a MainViewController in my Cocoa Touch app which shows a status view

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.