I introduced two buttons on the toolbar one 'CheckAll' and the other 'UncheckAll', they are to have effect on a particular column say 'Status' (with checkboxes) in the grid. I wrote two Javascript functions to do this.
function check_all(the_unchecked){
for(i=0; i<the_unchecked.length; i++){
the_unchecked[i].checked = true;
}
}
function uncheck_all(the_checked){
for(i=0; i<the_checked.length; i++){
the_checked[i].checked = false;
}
} The effected field:
{field: 'status', caption: 'Status', size: '50px', searchable: 'text', resizable: true, render: function (records) {
if (records.status === true) {
return '<span style="background-color:#a3e9a4; width:100%;display:block;"> <input class="enable_check" type="checkbox" name="enable_check[]" value="true" checked="true"></span>';
} else {
return '<span style="background-color:#f69988; width:100%;display:block;"> <input class="enable_check2" name="enable_check[]" value="false" type="checkbox"></span>';
}
}, style: 'text-align:center'},
The problem is when I clicked on Save button the checked buttons are nor sent/saved to the database.
What I want is when CheckAll is clicked it checks all checkboxes in the column Status of the fetched rows, then 'Save' persist all the changes to the database.