バックボーン カレンダー アプリケーションを実行しようとしています。私はモデルEvent
、EventView
およびを持っていDailyView
ます。
はDailyView
、時間を表すセルのリストを含むテーブルを含むテンプレートをロードします (例: td #09
)。セルをクリックして取得したいのですid
が、失敗します。の代わりにel: div
fromを参照していると思います。DailyView
td
DailyView = Backbone.View.extend({
tagName: "div",
template: _.template($('#daily-view').html()),
events: {
'click td': 'onClick'
},
initialize: function(){
_.bindAll(this, 'render');
this.model.bind('change', this.render, this);
this.render();
},
render: function(){
$(this.el).html(this.template(this.model.toJSON()));
return this;
},
onClick: function(){
var hour= $(this.el).attr("id");
//This doesn't work
}
Event
セルをサブビューとして追加することを考えました (空の場合もあれば、.
td
の代わりにを参照する方法はありdiv
ますか?