Skip to content

Instantly share code, notes, and snippets.

@cynx
Created August 21, 2015 10:28
Show Gist options
  • Save cynx/5b838e660a8c5c6c2408 to your computer and use it in GitHub Desktop.
Save cynx/5b838e660a8c5c6c2408 to your computer and use it in GitHub Desktop.
index.js - no vertical scroll
$(document).ready(function () {
$('#datatab tfoot th').each(function () {
$(this).html('<input type="text" />');
});
var oTable = $('#datatab').DataTable({
"serverSide": true,
"ajax": {
"type": "POST",
"url": '/Home/DataHandler',
"contentType": 'application/json; charset=utf-8',
'data': function (data) { return data = JSON.stringify(data); }
},
"scrollX": true,
"processing": true,
"paging": true,
"columns": [
{ "data": "Name" },
{ "data": "City" },
{ "data": "Postal" },
{ "data": "Email" },
{ "data": "Company" },
{ "data": "Account" },
{ "data": "CreditCard" }
],
"order": [0, "asc"]
});
oTable.columns().every(function () {
var that = this;
$('input', this.footer()).on('keyup change', function () {
that
.search(this.value)
.draw();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment