Trigger backbone.js change when value doesn't change

后端 未结 2 611
鱼传尺愫
鱼传尺愫 2021-02-12 21:59

It\'s a known feature of backbone.js that when you set data that hasn\'t changed it won\'t fire the change event, nor will it go through validations. I however need the change e

2条回答
  •  余生分开走
    2021-02-12 22:30

    Manually trigger the change event:

    t.model.trigger('change', t.model);
    

    or

    t.model.trigger('change:fieldErrors', t.model, newFieldErrorsValue);
    

提交回复
热议问题