user1587365
user1587365

Reputation: 11

how to integrate backgrid with backbone layoutmanager

This is my code :

beforeRender : function() {
    var columns=[{name:'hq_name',label:'Headquarter Name',cell:'string'},{name:'description',label:'Description',cell:'string'}];
    var grid=new Backgrid.Grid({
        columns:columns,
        collection:this.collection
    });
    this.insertView(grid.render().el);
}

it's throwing this error

Uncaught TypeError: Cannot read property 'manager' of undefined

Upvotes: 1

Views: 793

Answers (3)

Desperado
Desperado

Reputation: 36

Instead of this.insertView(grid.render().el); Try this: this.$el.append(grid.render().el);

Upvotes: 0

mattimatti
mattimatti

Reputation: 967

I run in the same issues integrating BackGrid with Backbone Boilerplate + (Lodash + backbone.layoutmanager).

The above suggestion from the author doesn't work for me.

You have to be sure that the manage property in Backbone.LayoutManager.configure is set to false. Otherwise the inner render methods (body,header, etc..) of BakGrid won't work as expected.

Backbone.LayoutManager.configure({
    manage: false
});

Lodash v 1.2 with underscore compatibility v. seems to work fine in first trials.

Btw: thank you Y.H Wong for your good work.

Upvotes: 1

Y.H Wong
Y.H Wong

Reputation: 7244

Instead of

this.insertView(grid.render().el);

Try this:

this.insertView(grid);

Upvotes: 0

Related Questions