2015-07-13 139 views
-2
columns: [ 
      { 
       data: 'ch', 
       type: 'checkbox', 
       checkedTemplate: 'yes', 
       uncheckedTemplate: 'no' 
      }] 

如果你想這樣的複選框..你可能會認爲選擇具有obj.setDataAtCell(row, col, "yes");選擇所有複選框

回答

-2

所有複選框,但這種方式很慢..所以我找到了偉大的方式,以最快的方式直接訪問數據對象。並且呈現數據

function checkAll(x) { 
    if(x) { 
     for(i=0; i<gh.getData().length;i ++) 
      console.log(gh.getData()[i].ch = "yes"); 
    } else { 
     for(i=0; i<gh.getData().length;i ++) 
      console.log(gh.getData()[i].ch = "no"); 
    } 
    gh.render(); 
} 

感謝