I am generating checkboxes in my Bootgrid table and after click on one checkbox I am changing value in DB (0 and 1) using ajax post call.... Everything works and looks find in Bootgrid table, but if I click on table header to sort column (first or last name or something else) Bootgrid automatically reset all values from checkboxes at the previous state, so how can I force bootgrid to always take last/as is state as default.
I have tried with $('#exampleTable').refresh();
but it is the same (reverting change)
Here is my code
$('#exampleTable').bootgrid({
rowCount: [10],
css: {
...
},
formatters: {
...,
'emailDocument': function (column, row) {
let isChecked = row.emailDocument ? 'checked' : '';
let userID = row.userId;
let elementId = 'emailDocuments';
let userRootSettings = parseInt(row.userRootSettings);
return getToggleButton(elementId, userID, isChecked);
},
...
}
}).on('click.rs.jquery.bootgrid', function (e, cols, row) {
if (typeof row != 'undefined') {
$('#emailDocuments' + row.userId).unbind().click(function () {
let newSettingValue = row.emailDocument ? 0 : 1;
updateUserAddressSettings('documentsPerEmail', row.userAddressId, newSettingValue);
});
}
});