0
모델 바인딩에 require.js와 stickit을 사용하고 있습니다. 'change'이벤트는 잘 작동하지만 focusout을 위해 keyup을 사용하면 checkBindings() 함수가 실행되지 않습니다. 이게 왜 그렇게?백본에서 모델을 바인딩 할 때 keyup 이벤트가 실행되지 않음
Stickit = require('stickit'),
ApplicantModel = require('application/models/applicantModel'),
template = _.template(tpl),
applicantView = Backbone.View.extend({
initialize: function() {
this.listenTo(this.model, 'change', this.checkBinding); //Change works fine, but keyup, focusout and other events do not fire
this.render();
},
checkBinding: function() {
console.log('Inside check binding functions');
var data = this.model.toJSON();
console.log($('#applicantInfoFirstName').val());
console.log($('#applicantInfoMiddleName').html(JSON.stringify(data.middleName)));
},
bindings: {
'#applicantInfoFirstName': 'firstName',
'#applicantInfoMiddleName': 'middleName',
'#applicantInfoLastName':'lastName'
},
render: function() {
console.log("Inside applicant view");
//Render application header
this.$el.html(template);
this.stickit();