2013-03-02 72 views
-1

我有一些问题处理的jqGrid的时候,我在这里的情况:如何仅选择jqgrid中启用的复选框?

  1. 我试图设置multiselect:true

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

  3. 如果我从列表中选择所有复选框,在这里如何启用复选框行ID?

+0

复制链接的问题http://stackoverflow.com/questions/5259262/jqgrid-multiselect-and-disable-入住条件 – 2013-03-03 06:34:33

回答

0

我假设你已经确定你的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 

    } 

});