开发者

JqGrid Edit & Delete button with each row

i m using jqgrid with mvc 3, I want to add Edit and Delete button with开发者_Go百科 every row of JqGrid , i have achieved this thing by the help of this link. But it is for inline editing, i want to open a popup widows when click on edit button.

How can i achieve this thing.

Thanks


You should just use new editformbutton: true option which exists starting with version 4.1.0 of jqGrid:

formatter:'actions',
formatoptions: {
    keys: true,
    editformbutton: true
}


Please find the colmodel below for editing:

 {
                    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")'
                    }
                },


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: 'Enter a Name'} }, {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
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜