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

问题描述

我有一个在线删除按钮,我想像这样将更多数据附加到删除消息弹出窗口中:删除代码为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>?");}

问题是,如果我在不首先单击行的任何部分的情况下单击删除按钮,则提示为null或得到先前选择的行而不是当前选择的行!

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内联删除:选择行“选择"是不正确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 09:13