可以自己添加按钮:
1. 想dialog 增加自己的方法,addbutton 和 removebutton
$.extend($.ui.dialog.prototype, {
'addbutton': function(buttonName, func) {
var buttons = this.element.dialog('option', 'buttons');
buttons[buttonName] = func;
this.element.dialog('option', 'buttons', buttons);
}
});
$.extend($.ui.dialog.prototype, {
'removebutton': function(buttonName) {
var buttons = this.element.dialog('option', 'buttons');
delete buttons[buttonName];
this.element.dialog('option', 'buttons', buttons);
}
});
Add it into into a JS file if you wish. Usage:
2. 使用
$('#MyDialog').dialog('removebutton', 'Old Button');
$('#MyDialog').dialog('addbutton', 'New Button', newButtonClickFunction);
function newButtonClickFunction() {
alert('You clicked the new button!');
}