JQuery ダイアログで Backbone.js を使用しようとしています。ダイアログをレンダリングして開くことができましたが、イベントが発生していないようです。これを確認するテスト イベントを追加しましたが、クリックしても期待どおりの結果が得られません。
delegateEventsに関して、このブログ投稿の指示に従ってみましたが、違いはありませんでした。エラーはスローされず、イベントは発生しません。どうしてこれなの?
Slx.Dialogs.NewBroadcastDialog.View = Backbone.View.extend({
events: {
"click .dialog-content": "clickTest"
},
clickTest : function () {
alert("click");
},
render: function () {
var compiledTemplate = Handlebars.compile(this.template);
var renderedContent = compiledTemplate();
var options = {
title: Slx.User.Language.dialog_title_new_message,
width: 500
};
$(renderedContent).dialog(options);
this.el = $("#newBroadCastContainer");
this.delegateEvents(this.events);
return this;
},
initialize: function () {
_.bindAll(this, 'render');
this.template = $("#newBroadcastDialogTemplate").html();
this.render();
}
});