title: How can I get size (height/width) information in Backbone Views?
body: <p>In the render function of my backbone app, I want to fill the rest of the table with empty rows for the alternating row look, but I dont know how many rows to add. I tried <code>this.el.clientHeight</code>, <code>$(this.el).height()</code>, and all other permutations of such functions to have them all return 0. Does anyone know how to do this? I also dont want to add too many in order not to introduce a scroll bar.</p>
  
  <pre>
  <code>
  var bar = Backbone.View.extend({
      initialize: function(){
          _.bindAll(this, "render");
      },
  
      render: function(){
          var html = "&lt;h1&gt;Hi!&lt;/h1&gt;";
          $(this.el).html(html);
          var myWidth = this.el.width();
          alert(myWidth);
          return this;
      }
  
  });
  
  
  
  var foo = Backbone.View.extend({
      el: $('#myElement'),
  
      initialize: function(){
          _.bindAll(this, "render");
          this.subview = new bar();
      },
  
      render: function(){
          $(this.el).append(this.subview.render().el);
          return this;
      }
  
  });
  
  
  
  </code>
  </pre>
  
  <p>Solution for those stuck with the same problem as I had: You have to wait for the elements to be fully attached to the dom in order to get height/width info. In order to resolve this I added a postrender call after the render is fully done which went back and handled any small details.</p>