0
我正在使用jQuery的可编辑和提交和取消我也想要1其他功能的额外按钮...任何人都可以帮忙吗?jquery可编辑的额外按钮/链接
我正在使用jQuery的可编辑和提交和取消我也想要1其他功能的额外按钮...任何人都可以帮忙吗?jquery可编辑的额外按钮/链接
必须扩展插件...做以下更改源
onEdit: null,
onSubmit: null,
onPopup: null, //function to be called when you click your custom popup button
onCancel: null,
editClass: null,
submit: null,
popup: null, //your custom popup button
popupBy: 'blur', //blur, change, dbclick, click
cancel: null,
type: 'text',
之后,你必须定义像
// popup event
if (opts.popup) {
$('<button/>').appendTo($this)
.html(opts.popup)
.one('mouseup', function() { opts.toNonEditable($(this).parent(), true) });
} else
$this.one(opts.popupBy, function() { opts.toNonEditable($(this), true) })
.children()
.one(opts.popupBy, function() { opts.toNonEditable($(this).parent(), true) });
选项最后添加以下内容调用用户定义功能的源
// Call User Function
var func = null;
if ($.isFunction(opts.onSubmit) && change == true)
func = opts.onSubmit;
else if ($.isFunction(opts.onCancel) && change == false)
func = opts.onCancel;
else if ($.isFunction(opts.onPopup) && change == true)
func = opts.onPopup;
如果一切顺利,您可以使用它作为
$('selector').editable({
type: 'select',
options: { 'value1': 'Item 1', 2: 'Item 2', 'Item 3': 'Item 3' },
submit: 'save',
popup:'click to open popup',
cancel: 'cancel',
editClass: 'colored',
onEdit: editFuncion,
onPopup:popupFunction,
onSubmit: submitFuncion
});
function popupFunction() {
// your logic to open popup
}
免责声明
我没有测试过,所以我不能确认是否会工作或没有,但你会得到的想法
测试它和它的工作... – Rafay 2011-03-02 07:06:11
ü要与其他按钮有什么功能? – diEcho 2011-03-02 06:00:17
我会打电话给一个弹出式链接/按钮 – supriya 2011-03-02 06:14:05