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 9170749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:04:12+00:00 2026-06-17T16:04:12+00:00

Has anyone had any success using a vertical table column as a view ‘el’

  • 0

Has anyone had any success using a vertical table column as a view ‘el’ using Backbone.js? Since tables are row-based, using a table row as the DOM container associated with the view is trivial. However, the layout I’m required to implement is vertical, so a table column would be the ‘el’ of my design, but table columns don’t have a similar container element since table layout is horizontal.

So far, I haven’t been able to successfully create child views for the table columns, which means I’m tying data to my DOM in order to retrieve and manipulate table columns. My design has gotten much more complex, which is causing me to reevaluate the original approach in the hope that there is a better way to manage this scenario through child views. Any ideas?

  • 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-17T16:04:13+00:00Added an answer on June 17, 2026 at 4:04 pm

    You could take advantage of the fact that

    • jQuery objects are lists of DOM elements
    • Backbone does not require a unique DOM node (at least as far as I can tell)
    • this.$el in a view can then be whatever nodes you want

    With that in mind, you could render your table in one go (see BackboneJS Rendering Problems, it’s faster and in your case probably much easier) and then apply your subviews on the table cells associated with the model. I went with a class name for selection but a selector on the nth element of each row should work.

    Template

    <table>
        <thead>
            <tr>
                <th></th>
                <% _(children).each(function(model) { %>
                    <th><%= model.id %></th>                
                <% }); %>
            </tr>
        </thead>
        <tbody>
        <% _(properties).each(function(prop) { %>
            <tr>
                <td><%= prop %></td>
                <% _(children).each(function(model) { %>
                    <td class="<%= model.cid %>"><% print(model[prop]); %></td>
                <% }); %>
            </tr>
        <% }); %>
        </tbody>
     </table>
    

    View

    ListView = Backbone.View.extend({
        initialize: function(opts) {
            this.options = opts;
        },
        render: function () {
            var data, html, $table, template = this.options.template;
    
            data = this.collection.map(function (model) {
                return _.extend(model.toJSON(), {
                    cid: model.cid
                });
            });
    
            html = this.options.template({
                children: data,
                properties: ['id', 'name']
            });
    
            $table = $(html);
    
            this.collection.each(function (model, ix) {
                var $el = $table.find("." + model.cid),
                    subview = new ItemView({
                        el: $el,
                        model: model
                    });
            });
    
            this.$el.empty();
            this.$el.append($table);
    
            return this;
        }
    });
    

    As you can check in this demo http://jsfiddle.net/nikoshr/psasT/12/, each column is handled by a dedicated view.

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

Sidebar

Related Questions

Has anyone had any success using a GPX route or track to test location
Has anyone had any success using Hudson (or another similar build system) with Perl?
I am sick of using a keyboard. Has anyone had any success with voice
Has anyone had any experiences developing large Java applications using GNU gettext for internationalization?
Has anyone had any experience using Adobe Air to create BitTorrent application? Is there
Has anyone had any experience of talking between an iSeries (using IBM's Websphere MQ)
Has anyone had this problem? I deleted a column in the table editor and
Has anyone had any success in getting Webistrano running on Windows. Everywhere I have
Has anyone had any success creating an info button (italic 'i' in a circle)
Has anyone had any success with libcurl and POP3 with APOP authentication? I had

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.