0

我正在使用 require.js 和stickit 进行模型绑定。'change' 事件工作正常,但如果我使用 keyup 进行焦点输出,则 checkBindings() 函数不会触发。为什么会这样?

        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();
4

1 回答 1

0

这些事件特定于模型中的更改。活动列表在这里

于 2014-06-17T08:23:29.560 回答