2013-03-02 41 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 

    } 

}); 
相關問題