Editor - Add Checkbox
Editor - Add Checkbox
dpanscik
Posts: 202Questions: 47Answers: 0
I'm trying to add a checkbox to a column. However this has no effect
The following "type": "checkbox",
has no effect.
Here is my code for editor
editor = new $.fn.dataTable.Editor({
ajax: '/api/APData',
table: "#ApForm",
"data": function (d) {
return $.extend({}, d, {
"form_id": "APgrid",
});
},
formOptions: {
inline: {
submit: 'allIfChanged',
},
},
fields: [
{
label: "PH",
name: "pinkHighlight",
type: "checkbox",
},
{
label: "YH",
name: "yellowHighlight",
type: "checkbox",
},
]
Here is my code for datatable
"columnDefs":
[
{ "defaultContent": "-", "targets": "_all" },
{
"targets": [12],
"visible": true,
"orderable": true,
"type": "checkbox",
},
{
"targets": [13],
"visible": true,
"orderable": true,
"type": "checkbox",
},
],
This question has an accepted answers - jump to answer
Answers
See if this example helps. You will need to use
columns.render
in your Datatable to show the checkbox.Kevin
This got me the checkbox! Thank you!