Rendering Backgrid when using Layoutmanager

215 views Asked by At

I'm using Layoutmanager with manage set to true

Backbone.Layout.configure({
    manage: true

which messes up rendering of the Backgrid.

When manage is set to false then the table is rendered correctly, but if I set manage to true, then the table does not render fully (no table head or body) but only <table class="backgrid"></table>.

1

There are 1 answers

0
Ross Williams On BEST ANSWER

I know this is an old question, but this is because both LayoutManager and Backgrid both use a "render" function. With manage set to true, LayoutManager overrides Backgrid's render function with its own.

The way I've gone around this is by making a new view that extends Backgrid and calling it's render function directly.

var myGrid = Backgrid.Grid.extend({
  manage:true,
 
  initialize: function(options) {
    Backgrid.Grid.prototype.initialize.call(this,options));
    this.renderGrid();
  },
 
  renderGrid: function() {
    Backgrid.Grid.prototype.render.call(this);
    return this;
  }
  
});