selectRow checkboxes
This commit is contained in:
parent
7be8bc936a
commit
319d8d59de
@ -14,13 +14,14 @@ function initSubscriptionTable() {
|
||||
},
|
||||
columnDefs: [
|
||||
{ orderable: false, targets: "no-sort" },
|
||||
// {
|
||||
// targets: 0,
|
||||
// checkboxes: { selectRow: true }
|
||||
// }
|
||||
{
|
||||
targets: 0,
|
||||
checkboxes: { selectRow: true }
|
||||
}
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
{
|
||||
// Select row checkbox column
|
||||
title: "",
|
||||
data: null,
|
||||
orderable: false,
|
||||
@ -48,16 +49,10 @@ function initSubscriptionTable() {
|
||||
orderable: false,
|
||||
className: "text-center",
|
||||
render: function(data, type) {
|
||||
var check = $('<input type="checkbox" class="form-check-input" />');
|
||||
check.prop("checked", data);
|
||||
return check[0]
|
||||
return `<input type="checkbox" class="form-check-input" ${data ? "checked" : ""} />`
|
||||
}
|
||||
},
|
||||
],
|
||||
createdRow: function(row, data, dataIndex) {
|
||||
// Insert checkbox in the first cell of each row
|
||||
$(row).find('td:eq(0)').html('<input type="checkbox" class="form-check-input" />');
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
subTable.rows.add([
|
||||
@ -105,11 +100,6 @@ $("#subTable tbody").on("change", "tr td:first-child .form-check-input", functio
|
||||
|
||||
if (selected) row.select();
|
||||
else row.deselect();
|
||||
|
||||
// $('#subTable tbody tr:not(.selected) td input[type="checkbox"]').prop("checked", false);
|
||||
// $('#subTable tbody tr.selected td input[type="checkbox"]').prop("checked", true);
|
||||
// subTable.rows(".selected").select();
|
||||
// subTable.rows(":not(.selected)").deselect();
|
||||
});
|
||||
|
||||
// Select all rows checkbox
|
||||
|
Loading…
x
Reference in New Issue
Block a user