简体   繁体   English

如何将Backgrid与主干layoutmanager集成

[英]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 未捕获的TypeError:无法读取未定义的属性' manager '

I run in the same issues integrating BackGrid with Backbone Boilerplate + (Lodash + backbone.layoutmanager). 我在将BackGrid与Backbone Boilerplate +(Lodash + bone.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. 您必须确保将Backbone.LayoutManager.configure中的manage属性设置为false。 Otherwise the inner render methods (body,header, etc..) of BakGrid won't work as expected. 否则,BakGrid的内部渲染方法(body,header等)将无法正常工作。

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

Lodash v 1.2 with underscore compatibility v. seems to work fine in first trials. 具有下划线兼容性v。的Lodash v 1.2似乎在第一次试用中工作良好。

Btw: thank you YH Wong for your good work. 顺便说一句:感谢黄永辉先生的出色工作。

Instead of 代替

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

Try this: 尝试这个:

this.insertView(grid);

Instead of this.insertView(grid.render().el); 代替this.insertView(grid.render()。el); Try this: this.$el.append(grid.render().el); 试试这个:this。$ el.append(grid.render()。el);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM