How to handle unknown column is column options
How to handle unknown column is column options

Hi,
I've configured my columns options with an "data" : "action" definition.
There may be occasions where no data is returned for the "action" column from the server.
It may be that actions are not relevant for some users, so I'd like to omit the column when it's not required.
How can I avoid getting this error?
DataTables warning: table id=dt_basic - Requested unknown parameter 'action' for row 0, column 2. For more information about this error, please see http://datatables.net/tn/4
This is my config...
{
"serverSide": true,
"serverMethod": "post",
"ajax": $.fn.dataTable.pipeline({
"url": "proc/list",
"pages": 5,
"method": "POST"
}),
"pageLength": 15,
"lengthMenu": [ [15, 30, 60, 90, 120], [15, 30, 60, 90, 120] ],
"order": [[ 1, "desc" ]],
"columns" : [
{
"data": "link",
"title" : "Link Details",
"orderable": false,
},
{
"data": "date",
"title": "<i class=\"fa fa-fw fa-calendar hidden-md hidden-sm hidden-xs\"><\/i> Date added",
"searchable": false
},
{
"data": "action",
"searchable": false,
"orderable": false,
}
]
}
Thanks
Answers
See if
columns.defaultContent
solves the issue.Kevin