x-editable:取消evert的回调

Gid*_*eon 1 javascript x-editable

对于Twitter Bootstrap X Editable(https://vitalets.github.io/x-editable/docs.html),有成功和错误的回调.但没有什么可以取消的.有没有办法监听特定可编辑的取消事件?

Gid*_*eon 5

弄清楚了:

  $('#element', this.$e).editable({
    type: 'text',
    toggle: 'manual',
    success: function(response, newValue) {
      //some action
    }.bind(this)
  }).on('hidden', function(e, reason) {
    if (reason == "cancel") {
      //some action
    }
  });
Run Code Online (Sandbox Code Playgroud)

您可以在"隐藏"上定义监听器,并检查取消或提交或手动的原因.