var table = $('#example_table'),
data;
table.dataTable({
ajax: {
url: '/admin.php',
data: {
modules: 'items',
action: 'get'
},
type: 'POST'
},
columns: [{
data: 'id'
}, {
data: 'label'
}, {
data: 'description'
}, {
data: function (row) {
return '<button type="button" class="btn btn-primary">' + row['id'] + '</button>'
}
}],
info: false,
lengthChange: false,
language: {
url: '/plugins/dataTables/ru.json',
sSearchPlaceholder: 'Поиск'
},
order: [
[0, 'desc']
],
pageLength: 20,
dom: '<f><t><p>'
})
The form $().dataTable() will return a jQuery object, while $().DataTable() returns a DataTables API instance.