Created
September 8, 2016 08:19
-
-
Save kossoff/6c9a55c2e7a8aff3df0d756e731e7fb8 to your computer and use it in GitHub Desktop.
Custom parameters for jQuery Datatables with server-side processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label | |
input#test-checkbox type="checkbox" | |
|Test checkbox | |
table#test-table | |
javascript: | |
$(document).ready(function() { | |
var table = $("#test-table").dataTable( { | |
"ajaxSource": '#{test_datatable_path}', | |
"serverSide": true, | |
"fnServerParams": function (aoData) { | |
aoData.push({name: "testCheckbox", value: $("#test-checkbox").is(":checked") }); | |
}, | |
"aoColumns": [ | |
{ "sTitle": 'Column 1', "name": 'column1'}, | |
{ "sTitle": 'Column 2', "name": 'column2'}, | |
{ "sTitle": 'Column 3', "name": 'column3', "orderable": false}, | |
], | |
}); | |
$('#test-checkbox').change( function() { table.fnDraw(); } ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment