主干,在子视图页面点击事件不适用于按钮" .rdp-sitting-more"
首先,我有一个名为main.view.js的视图。 我需要创建一个表格,其中每个" tr"价值我将从model.so我想为每个" tr"创建一个子视图,这将帮助我绑定模型为每个" tr" value.so,我创建一个" processCollection"功能。
现在问题是点击事件不适用于按钮" .rdp-sitting-more"。在" tr-subview.view.js"
中调用1.main.view.js
createSubview: function (model) {
if (!this.subView) {
this.subView = [];
}
var element = $('<tr role="row" class="odd"></tr>');
model["associates"] = this.appointmentdetailsModel.get("associates")[0];
var sittingObj = {};
_.each(model.sittings, function (sitting, index) {
sitting["index"] = sitting;
sittingObj[index] = sitting;
});
model["sittingsObj"] = sittingObj;
this.$el.find("tbody").append(element);
this.subView.push(new appointmentdetailsView({
el: element,
"model": model
}));
},
processCollection: function (options, appointmentdetailsModel) {
_.each(this.appointmentdetailsModel.get("orders"), function (Data) {
this.createSubview(Data);
}, this);
},
2.tr-subview.view.js
events:{
"click .rdp-sitting-more": "moreSitting",
}
moreSitting: function(){
alert("moresitting")
}
<tr class="sitting" colspan="2">
<td><button class="btn btn-xs btn-info rdp-sitting-more" data-value="" style="margin:10px 0">
<i class="ace-icon glyphicon glyphicon-plus"></i>
Add
</button></td>
</tr>
Could you please tell me what might be the issue?Why it's not binding the click event