$(document).ready(function() { $("#clear").click(function() { // clear all select fields $("select").val(''); }); var items_table = $("#items_table").DataTable({ "ajax": function(data, callback, settings) { $.getJSON( $SCRIPT_ROOT + "/inventory/_retrieve_items", function(json) { callback(json); }); }, "order": [[3, 'desc']], "pagingType": "full_numbers", "pageLength": 20, "lengthMenu": [[20, 50, 100, -1], [20, 50, 100, "All"]], "columnDefs": [ { "targets": [0], "visible": false, "searchable": false }, { "targets": [1, 9], "render": function(data, type, row) { // render funtion to create link to Item view page if ( data === null ) { return data; } var url = $SCRIPT_ROOT + "/inventory/items/view/" + data; return '<a href="'+ url + '">' + data + '</a>'; } } ] }); });