如何将自定义按钮添加到 JqGrid 添加/编辑表单?
是否可以将自定义按钮添加到 JqGrid 添加/编辑表单?
Is it possible to add custom buttons to a JqGrid add/edit form?
我想要一个显示保存并新建"的按钮,一个显示保存并关闭"的按钮,以及一个显示取消"的按钮,而不仅仅是提交和取消.
Instead of just submit and cancel, I wanted to have a button that says "Save and New", one that says "Save and Close", and one that says "Cancel".
有可能实现吗?
推荐答案
jqGrid 有一些用于按钮的 CSS 类.例如,您可以在 beforeShowForm 回调中添加新按钮:
jqGrid has some CSS classes which will be used for buttons. You can add new button inside of beforeShowForm callback for example:
$.extend($.jgrid.edit, {
bSubmit: "Save and Close",
bCancel: "Cancel",
width: 370,
recreateForm: true,
beforeShowForm: function () {
$('<a href="#">Save and New<span class="ui-icon ui-icon-disk"></span></a>')
.click(function() {
alert("click!");
}).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
.prependTo("#Act_Buttons>td.EditButton");
}
});
参见演示:
相关文章