jqgrid,按钮以编辑形式填充值?

时间:2012-07-27 15:45:19

标签: javascript jquery forms button jqgrid

我希望在其中一个输入字段旁边的jqgrid编辑表单中添加一个按钮。当我单击按钮时,我想在输入字段中放置一个特定值。我可以处理在字段中插入我想要的文本的代码。我不知道的部分是如何使自定义按钮出现在文本字段旁边。查看我的草图,按钮。然后我只需要有能力:

$('#my_new_button').click(...

enter image description here

有谁知道如何在编辑表单中获取此自定义按钮?

谢谢!

2 个答案:

答案 0 :(得分:2)

是的,我觉得它可能,看到这个回答的人首先克隆了提交按钮,然后更改了提交按钮的属性,然后将其添加到你想要的元素之后,在你的情况下,它应该在textBox之后总计(获取Id),然后编写关于你想要点击的内容的功能......

http://www.trirand.com/blog/?page_id=393/help/add-your-own-custom-buttons-to-a-form-edit-dialog-page/

并且通过这个答案,您可能会得到一些帮助,他首先更改提交按钮,然后再添加一个新的自定义按钮......您可以从中获取该功能..

How to add custom buttons to JqGrid add/edit forms?

答案 1 :(得分:0)

//Insert a link after #member_id into edit form

    $.extend($.jgrid.edit, {
        recreateForm: true,
        width:700,
        viewPagerButtons:false,
        beforeShowForm: function ($form) {
            $('CHECK ID')
                .click(function() {
                    alert("ID IS OK!");
                }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
                  .insertAfter("#member_id");
        }
    });


//Insert a link after #member_id into add form

    $.extend($.jgrid.new, {
        recreateForm: true,
        width:700,
        viewPagerButtons:false,
        beforeShowForm: function ($form) {
            $('CHECK ID')
            .click(function() {
                alert("ID IS OK!");
            }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left")
              .insertAfter("#member_id");
        }
    });