JavaScript
$(document).ready(function () {
/* Create an array with the values of all the input boxes in a column */
$.fn.dataTable.ext.order['dom-text'] = function (settings, col) {
return this.api().column(col, {
order: 'index'
}).nodes().map(function (td, i) {
return $('input', td).val();
});
}
/* Create an array with the values of all the input boxes in a column, parsed as numbers */
$.fn.dataTable.ext.order['dom-text-numeric'] = function (settings, col) {
return this.api().column(col, {
order: 'index'
}).nodes().map(function (td, i) {
return $('input', td).val() * 1;
});
}
/* Create an array with the values of all the select options in a column */
$.fn.dataTable.ext.order['dom-select'] = function (settings, col) {
return this.api().column(col, {
order: 'index'
}).nodes().map(function (td, i) {
return $('select', td).val();
});
}
/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTable.ext.order['dom-checkbox'] = function (settings, col) {
return this.api().column(col, {
order: 'index'
}).nodes().map(function (td, i) {
return $('input', td).prop('checked') ? '1' : '0';
});
}
$('#jxoutput').DataTable({
"aaData": [
["39", "3", "test11", "0", "active"],
["32", "3", "test3", "0", "active"],
["40", "3", "test12", "1", "active"],
["30", "3", "test1", "2", "inactive"],
["31", "3", "test2", "2", "active"],
["41", "3", "test13", "3", "active"],
["33", "3", "test4", "4", "active"],
["34", "3", "test5", "5", "active"],
["36", "3", "test7", "6", "active"],
["38", "3", "test9", "7", "active"],
["42", "3", "test4", "55",...