【问题标题】:How to select only enabled check boxes in jqgrid?如何在 jqgrid 中仅选择启用的复选框?
【发布时间】:2013-03-02 10:41:00
【问题描述】:

我在处理 JqGrid 时遇到了一些问题,这里是我的情况:

  1. 我尝试设置multiselect:true

  2. 我尝试设置一些行复选框,使用loadComplete 事件句柄禁用复选标记。

  3. 如果我从列表中选择所有复选框,如何在此处获取启用的复选框行 ID?

【问题讨论】:

标签: jquery jqgrid


【解决方案1】:

我假设您已将 jqgrid 对象定义为网格

grid.jqGrid(

beforeSelectRow: function(rowid, e) {

    var disabledCheckboxes = $("tr#"+rowid+".jqgrow > td > input.cbox:disabled", grid[0]);

    if (disabledCheckboxes.length === 0) {

        return true;    // allow select the row

    } else {

        return false;   // not allow select the row

    }

},

onSelectAll: function(aRowids,status) {

    if (status) {

        var Checkboxes = $("tr.jqgrow > td > input.cbox:disabled", grid[0]);

        Checkboxes.removeAttr("checked");

          grid[0].p.selarrrow = grid.find("tr.jqgrow:has(td > input.cbox:checked)")

            .map(function() { return this.id; }) // fatch ids

            .get(); // convert to instance of Array

    }

});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-21
    相关资源
    最近更新 更多