我正在尝试用Backbone.js视图呈现的标记创建一个jQuery UI accordion小部件。我的视图代码如下:
var AccessPointAccordion = Backbone.View.extend({
el: $("#access_point_accordion"),
initialize: function() {
this.collection = new AccessPoint(bootstrappedModels);
this.render(); // renders the markup correctly
this.$el.accordion();
}
.
.
.
});虽然标记被正确呈现,但它并没有呈现为折叠窗口小部件,而只是作为未设置样式的标记。我是一个Backbone.js新手,谁能指出我是否犯了一个简单的错误,以及如何修复它?
发布于 2012-10-04 20:44:28
你可以在你的渲染函数中尝试这样做:
render: function(){
//template and other code
setTimeout("this.$el.accordion();",0);
return this;
}https://stackoverflow.com/questions/12724378
复制相似问题