本文介绍了如何向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".

是否有可能实现这一目标?

Is it possible to achieve this?

推荐答案

jqGrid有一些将用于按钮的CSS类。您可以在回调中添加新按钮,例如:

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");
    }
});

参见:

这篇关于如何向JqGrid添加/编辑表单添加自定义按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 22:09
查看更多