X-Editable:将事件附加到数据更改

时间:2021-09-27 14:28:15

How to attach events to any data changes in fields done using XEditable? If not if there is any other plugin that allows that kind of behavior?

如何将事件附加到使用XEditable完成的字段中的任何数据更改?如果没有,如果有其他插件允许这种行为?

3 个解决方案

#1


8  

I am using Angular-xeditable, And i am able to bind events and add other attributes too. Add e-onChange="alert('I am Fired')" to your needed HTML Tag. For Example:

我正在使用Angular-xeditable,我还可以绑定事件并添加其他属性。将e-onChange=“alert('I am Fired')”添加到所需的HTML标记中。例如:

<a href="#" editable-text="user.name" e-onChange="alert('I am Fired')" e-style="color: green" e-required e-placeholder="Enter name">

http://jsfiddle.net/cg3pLmed/

http://jsfiddle.net/cg3pLmed/

And by JavaScript

通过JavaScript

$('#username').on('save', function(e, params) {
     alert('Saved value: ' + params.newValue);
});

Fired when new value was submitted. You can use $(this).data('editable') to access to editable instance. Check with the Events in the following link http://vitalets.github.io/x-editable/docs.html

当提交新值时触发。可以使用$(this).data('editable')访问可编辑实例。查看以下链接http://vitalets.github.io/x-editable/docs.html中的事件

#2


4  

You can use e-ng-change to add a callback like this:

可以使用e-ng-change添加回调:

<span editable-select="user.status" e-name="status" 
    e-ng-change="onStatusChanged($data)" 
    e-ng-options="s.value as s.text for s in statuses">

Here is a fiddle where the Status selectbox will fire the Controller method onStatusChanged:

下面是一个小提琴,状态选择框将触发控制器方法onStatusChanged:

http://jsfiddle.net/NfPcH/9713/

http://jsfiddle.net/NfPcH/9713/

#3


0  

You can use the success or error callback functions for basic X-Editable without Angular. See http://vitalets.github.io/x-editable/docs.html#editable

对于基本的X-Editable,您可以使用成功或错误回调函数,而不用考虑角度。看到http://vitalets.github.io/x-editable/docs.html编辑

#1


8  

I am using Angular-xeditable, And i am able to bind events and add other attributes too. Add e-onChange="alert('I am Fired')" to your needed HTML Tag. For Example:

我正在使用Angular-xeditable,我还可以绑定事件并添加其他属性。将e-onChange=“alert('I am Fired')”添加到所需的HTML标记中。例如:

<a href="#" editable-text="user.name" e-onChange="alert('I am Fired')" e-style="color: green" e-required e-placeholder="Enter name">

http://jsfiddle.net/cg3pLmed/

http://jsfiddle.net/cg3pLmed/

And by JavaScript

通过JavaScript

$('#username').on('save', function(e, params) {
     alert('Saved value: ' + params.newValue);
});

Fired when new value was submitted. You can use $(this).data('editable') to access to editable instance. Check with the Events in the following link http://vitalets.github.io/x-editable/docs.html

当提交新值时触发。可以使用$(this).data('editable')访问可编辑实例。查看以下链接http://vitalets.github.io/x-editable/docs.html中的事件

#2


4  

You can use e-ng-change to add a callback like this:

可以使用e-ng-change添加回调:

<span editable-select="user.status" e-name="status" 
    e-ng-change="onStatusChanged($data)" 
    e-ng-options="s.value as s.text for s in statuses">

Here is a fiddle where the Status selectbox will fire the Controller method onStatusChanged:

下面是一个小提琴,状态选择框将触发控制器方法onStatusChanged:

http://jsfiddle.net/NfPcH/9713/

http://jsfiddle.net/NfPcH/9713/

#3


0  

You can use the success or error callback functions for basic X-Editable without Angular. See http://vitalets.github.io/x-editable/docs.html#editable

对于基本的X-Editable,您可以使用成功或错误回调函数,而不用考虑角度。看到http://vitalets.github.io/x-editable/docs.html编辑