📜  数据表布尔列复选框 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:54.536000             🧑  作者: Mango

代码示例1
var simple_checkbox = function ( data, type, full, meta ) {
    var is_checked = data == true ? "checked" : "";
    return '';
}

var setup_datatable = function () {
    $('#data-table').DataTable({
        "columns": [
            { "data": "id", "className": "text-center"},
            { "data": "keywords"},
            { "data": "platform"},
            { "data": "is_active", "render": simple_checkbox},
            { "data": "is_terminated", "render": simple_checkbox}
        ],
        "ajax": "/data"
    }); // DataTable

}