【问题标题】:Retrieving jqgrid checkbox column values检索 jqgrid 复选框列值
【发布时间】:2011-05-18 19:12:23
【问题描述】:

试图检索在 jqgrid 中选中其复选框的记录的 id 列。我有下面的代码显示复选框列。

{ name: 'checkbox', index: 'checkbox',  formatter: "checkbox", formatoptions: { disabled: false }, editable: true, edittype: "checkbox" }

和下面的代码来编辑选定的 jqgrid 行

jQuery('#list').editRow(id, true, formatEditors);

我的问题是,在单击提交/任何按钮后,如何(我不确定是否可以)浏览 jqgrid 中的所有选定记录? 所以在我的控制器(mvc2)的事件处理程序中,我想访问在 jqgrid 中选择的记录的所有 id 值。

我还浏览了asp.net mvc 2 jqgrid add record 中的代码,我可以显示添加按钮,但我无法检索用户选择的行(复选框)

任何帮助将不胜感激,因为我找不到类似的例子。 提前致谢!

【问题讨论】:

  • 任何人对这篇文章有任何看法,我真的很感激我花了很多时间没有结果!!

标签: jqgrid checkbox


【解决方案1】:

这是我最后总结出来的答案

 for (var i = 0; i < inputs.length; i++) {

                if (inputs[i].type == 'checkbox' && inputs[i].checked) {

                    var p = inputs[i].parentNode.parentNode;
                    var id = p.id;

                           $.ajax({
                           mtype: "POST",
                           url: '<%= Url.Action("action") %>',
                            data: { actionparameter: id },
                           contentType: "application/json; charset=utf-8",
                           dataType: "json",
                           async: false,
                           cache: false

              }); 
              }
          }

用户还应该创建一个按钮并将上述代码添加到该按钮的 jquery 中,该操作将只是一个在控制器中执行该过程的操作,我希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-25
    • 2017-02-04
    • 2013-06-02
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多