...
| Info |
|---|
An inverse function is also included inside the code from line 15-22. |
| Code Block | ||||
|---|---|---|---|---|
| ||||
<div class="btn btn-primary" id="custom-check-all">Check All</div>
<div class="btn btn-primary" id="custom-invert-all">Invert All</div>
<script>
$(function(){
var hot = FormUtil.getField("field1").data("hot");
$('#custom-check-all').on('click', function(){
rowcount = hot.countRows();
for(i = 0; i < rowcount - 1; i++){ // rowcount - 1 to ignore last row
hot.setDataAtCell(i, 1, true); // (row, column, value). column is 1 because checkbox is 2nd col in the table
}
})
$('#custom-invert-all').on('click', function(){
rowcount = hot.countRows();
for(i = 0; i < rowcount - 1; i++){
if(hot.getDataAtCell(i,1) == true){
hot.setDataAtCell(i, 1, false);
}
else{
hot.setDataAtCell(i, 1, true);
}
}
})
})
</script> |
...
Figure 2: Insert Javascript code into Custom HTML
Step 3
Result:
Figure 3: Check all expected result
Figure 4: Invert all expected result
Sample App
| View file | ||||
|---|---|---|---|---|
|



