An empty column when ajax sourced
An empty column when ajax sourced
Jamaur
Posts: 87Questions: 10Answers: 0
I have an ajax sourced table & I wish to have a column not attached to any object property (no columns.data
specified) i.e. an empty column.
The below code throws errors in the console and displays alert. Please note that the first column is set to null.
var table = $('#example').DataTable( {
"serverSide": false,
"ajax": "https://api.myjson.com/bins/1frdi",
"columns": [
null,
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
Test Case: http://live.datatables.net/letehocu/1/edit
You will probably ask me, why would you need an empty column? Ex: Control column for responsive extension or Check-box column for select extension
This discussion has been closed.
Answers
Datatable seems to let the user not specify
columns.data
when settingcolumns.defaultContent
to an empty string (shown below). Is this correct?