jqGrid 内联删除:选中的行“selrow";是不正确的 [英] jqGrid inline delete: selected row "selrow" is incorrect

查看:26
本文介绍了jqGrid 内联删除:选中的行“selrow";是不正确的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内联删除按钮,我想将更多数据附加到删除消息弹出窗口,如下所示:"删除代码 = 7 的选定行?"

I have a in-line delete button, I want to append more data to the delete message pop-up like this: "Delete selected row with code = 7 ?"

我在 delOptions 中使用以下内容:

I'm using the following in the delOptions:

beforeShowForm: function ($form) {
var sel_id = $("#list").jqGrid('getGridParam', 'selrow');
$("td.delmsg", $form[0]).html("Delete record with <b>code=" + $("#list").jqGrid('getCell', sel_id, 'cd') + "</b>?");}

问题是如果我单击删除按钮而不先单击行的任何部分,则 selrow 要么为空,要么获取先前选择的行而不是当前选择的行!

The problem is If I click on the delete button without first clicking on any part of the row, the selrow is either null or it gets the previously selected row not the currently selected!

点击垃圾桶图标时如何选择行?

How do I make the row selected when clicking on the trash bin icon?

感谢任何帮助

推荐答案

我想你使用的是我在 老回答.它是在导航栏中使用删除按钮(表单编辑的一部分)的情况下编写的.

I suppose that you use the example which I posted in the old answer. It was written in case of usage of the Delete button (the part of form editing) from navigator bar.

删除对话框中有一个隐藏行可以帮助您.试试这个

There are one hidden row in the Delete dialog which could help you. Try this one

beforeShowForm: function ($form) {
    // get comma separated list of ids of rows which will be delete
    // in case of multiselect:true grid or just id of the row.
    // In the code below we suppose that single row selection are used
    var idOfDeletedRow = $("#DelData>td:nth-child(1)").text();
    $form.find("td.delmsg").eq(0)
        .html("Delete record with <b>code=" +
            $(this).jqGrid('getCell', idOfDeletedRow, 'cd') + "</b>?");
    // REMARK: in old versions of jqGrid you can't use $(this) and
    //         will have to use something like $("#list")
}

这篇关于jqGrid 内联删除:选中的行“selrow";是不正确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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