I use jQuery datatables checkboxes extention to give my talbe multi select function. when any row's checkbox clicked, I retieve all selected row's first cell's data send to server.
the code work at Chrome browser, but not work at IE browser.
$(document).ready(function () {
var table = $('#tbl_inv').DataTable({
"paging": false,
//"ordering": false,
"info": false,
"searching": false,
'columnDefs': [
{
'targets': 0,
'checkboxes': {
'selectRow': true
}
}
],
'select': {
'style': 'multi'
},
'order': [[1, 'asc']]
});
$('#tbl_inv input[type="checkbox"]').on('change', function () {
$.ajax({
url: '/Invoices/Pickup?handler=CalcTotaltoPay',
data: {
invIds: $('#tbl_inv').DataTable().column(0).checkboxes.selected().join(),
clientId:1234
}
})
.done(function (result) {
freshResult(result);
});
// Iterate over all selected checkboxes
//$.each(table.column(0).checkboxes.selected(), function (index, rowId) {
// console.log(index + '---' + rowId)
// console.log(table.cell(index, 5).data())
//});
});
});
when use IE browser, .column(0).checkboxes.selected() return a list, this list not include current clicked checkbox state change. meaning, when checkbox checked, .column(0).checkboxes.selected() return a list not include current checkbox's data. when checkbox unchecked, .column(0).checkboxes.selected() return a list still include this checkbox's data.
Aucun commentaire:
Enregistrer un commentaire