バックグリッドのレンダリング中
<table class="backgrid"></table>
しかし他には何もありません。Backgrid:render() のブレークポイントに達していません。私はバックボーンの初心者なので、何が起こっているのか正確にはわかりませんが、 LayoutManager:render() が呼び出されます..バックグリッドに到達しないようです...表示したいデータがフェッチされていますそれらが正しい形式であるかのように見えます...しかし、Backbone コレクションにまとめられると、見分けるのが難しいことを認めなければなりません。デバッグ方法/Backgrid のレンダーが呼び出されない理由についてのポインタは、感謝して受け取りました。
以下のコード:
ListenView.js
define([
'backbone',
'underscore',
'backgrid',
'app/models/PersonModel',
'app/collections/PersonCollection',
'app/views/PersonListView',
'hbs!app/templates/listen_template'
],
function(
Backbone,
_,
Backgrid,
Person,
PersonCollection,
PersonListView,
listenTemplate
) {
App = window.App || {};
var ListenView = Backbone.View.extend({
template: listenTemplate,
initialize: function(params) {
//fetch the list of seen people
this.model.attributes.seenPeople.fetch( {
success: function(coll, resp) {
//console.log(coll);
}
});
},
afterRender: function() {
//initialise person view
console.log("creating Backgrid");
this.seenPeopleView = new Backgrid.Grid({
columns: [{
name: "email",
label: "Email",
cell: "string"
},{
name: "id",
label: "ID",
cell: "integer"
}, {
name: "title",
label: "Title",
cell: "string" }
],
collection: this.model.attributes.seenPeople
});
this.seenPeopleView.render();
$('#seen-people-list').append(this.seenPeopleView.el);
}