jqGrid的EditActionIconsColumn活动 [英] jqgrid EditActionIconsColumn Events

查看:304
本文介绍了jqGrid的EditActionIconsColumn活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在网格提供给我一个EditActionsIconsColumn但jqGrid的我试图让编辑,德尔单击事件的保持和提交。
谢谢

I have a jqgrid with EditActionsIconsColumn available to me in the grid but I am trying to get a hold of the click events on the Edit, Del and Submit. Thanks

推荐答案

格式:动作还没有很好的记录。 jqGrid的当前版本3.8.2支持某些你需要的选项。在线394-466的中jquery.fmatter.js的目前的版本你可以看到更多。

The formatter:'actions' is not yet good documented. The current version of jqGrid 3.8.2 support some options which you need. In lines 394-466 of the jquery.fmatter.js of the current version you can see more.

您需要的是什么 onEdit afterSave (提交)和 delOptions .onclickSubmit 参数。

What you need are onEdit, afterSave (on "Submit") and delOptions.onclickSubmit parameters.

说实话我以前没有使用'行动'格式化,并了解它自己写该演示也对解决你所有的问题。为了使其他更容易找到例子包括:code,这里的最重要的部分:

To tell the truth I didn't use the 'actions' formatter before and to understand it myself write the demo which solve also on all your questions. To make other easier to find the example in include the most important part of the code here:

var grid = $("#list");
grid.jqGrid({
    datatype: "local",
    data: mydata,           // init local data which will be edited
    editurl: 'clientArray', // we will use local editing
    colNames:['Actions', ... ],
    colModel:[
        {name:'act',index:'act',width:55,align:'center',sortable:false,formatter:'actions',
         formatoptions:{
             keys: true, // we want use [Enter] key to save the row and [Esc] to cancel editing.
             onEdit:function(rowid) {
                 alert("in onEdit: rowid="+rowid+"\nWe don't need return anything");
             },
             onSuccess:function(jqXHR) {
                 // the function will be used as "succesfunc" parameter of editRow function
                 // (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing#editrow)
                 alert("in onSuccess used only for remote editing:"+
                       "\nresponseText="+jqXHR.responseText+
                       "\n\nWe can verify the server response and return false in case of"+
                       " error response. return true confirm that the response is successful");
                 // we can verify the server response and interpret it do as an error
                 // in the case we should return false. In the case onError will be called
                 return true;
             },
             onError:function(rowid, jqXHR, textStatus) {
                 // the function will be used as "errorfunc" parameter of editRow function
                 // (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing#editrow)
                 // and saveRow function
                 // (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing#saverow)
                 alert("in onError used only for remote editing:"+
                       "\nresponseText="+jqXHR.responseText+
                       "\nstatus="+jqXHR.status+
                       "\nstatusText"+jqXHR.statusText+
                       "\n\nWe don't need return anything");
             },
             afterSave:function(rowid) {
                 alert("in afterSave (Submit): rowid="+rowid+"\nWe don't need return anything");
             },
             afterRestore:function(rowid) {
                 alert("in afterRestore (Cancel): rowid="+rowid+"\nWe don't need return anything");
             },
             delOptions: {
                 // because I use "local" data I don't want to send the changes to the server
                 // so I use "processing:true" setting and delete the row manually in onclickSubmit
                 onclickSubmit: function(rp_ge, rowid) {
                     // we can use onclickSubmit function as "onclick" on "Delete" button
                     alert("The row with rowid="+rowid+" will be deleted");

                     // reset processing which could be modified
                     rp_ge.processing = true;

                     // delete row
                     grid.delRowData(rowid);
                     $("#delmod"+grid[0].id).hide();

                     if (grid[0].p.lastpage > 1) {
                         // reload grid to make the row from the next page visable.
                         // TODO: deleting the last row from the last page which number is higher as 1
                         grid.trigger("reloadGrid", [{page:grid[0].p.page}]);
                     }

                     return true;
                 },
                 processing:true // !!! the most important step for the "local" editing
                                 //     skip ajax request to the server
             }
         }},
        ...
    ],
    ...
});

这篇关于jqGrid的EditActionIconsColumn活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆