0

我在 mvc 3 中使用 jqgrid,我想在 JqGrid 的每一行中添加编辑和删除按钮,我通过这个链接实现了这个功能。但它是用于内联编辑的,我想在单击编辑按钮时打开一个弹出窗口。

我怎样才能做到这一点。

谢谢

4

3 回答 3

5

您应该只使用从 jqGrid 4.1.0 版本开始存在的新editformbutton: true选项:

formatter:'actions',
formatoptions: {
    keys: true,
    editformbutton: true
}
于 2011-08-27T09:43:58.490 回答
2

请在下面找到 colmodel 进行编辑:

 {
                    name: 'EditAction',
                    width: 60,
                    fixed: true,
                    search: false,
                    sortable: false,
                    resize: false,
                    formatter: 'actions',
                    formatoptions: {
                        keys: false,
                        editbutton: true,
                        delbutton: false,
                        editformbutton: false,
                        onSuccess: function(response) {
                            if (response.status == 200) {
                            }
                        },
                        extraparam: { oper: 'edit' },
                        url: '@Url.Action("ActionName", "Controller")'
                    }
                },
于 2014-05-15T16:26:47.483 回答
0

jQuery("#grid").jqGrid({ datatype: "local", data: second, @ url: '@Url.Action("orders", "Home")', datatype: "json", @ colNames: [ 'name', 'description', 'url'], colModel: [ {name: 'name', index: 'name', editable: true, editrules: {required: true}, editoptions: {placeholder: '输入名称'} }, {name: 'description', index: 'description', editable: true, editrules: {required: true}, editoptions: {placeholder: 'Enter description'} },

        {
      name: 'url',
        index: 'url',
        editable: true,
         editrules: {required: true},
         editoptions: {placeholder: 'Enter url'}
}
        ],

    rowNum: 10,
    rowList: [10, 20, 30],
    sortname: 'model',
    pager: '#pager',
    editrow:true,
    editurl: '@Url.Action("orders", "Home")',
    viewrecords: true,
    sortorder: "desc",
    jsonReader: {
        repeatitems: false,
        id: "0"
    },
     searching: {
            loadFilterDefaults: false,
            closeOnEscape: true,
            searchOperators: true,
            searchOnEnter: true
        },
    caption: "Cars Grid",
    height: '80%',
    gridComplete: initGrid
});
于 2021-09-22T09:58:27.767 回答