Settings for Datatables

"iDisplayLength": 25, 50, 100 //Used to determine the amount of items on one page "dom": '<"top"fp<"clear">>rt<"bottom"lip<"clear">>' //Used to re-organize how the datatable's layout "aaSorting": [5, 'asc'], //Used to set initial sort column. This table would be sorted ascending by the 6th column since the counting starts at 0 language: { //Changes the placeholder inside the search bar searchPlaceholder: "(Enter what you want to be displayed in search bar)" }, "columnDefs": [ { "className": "col-center", //adds col-center class to the column making the column centered "targets": 0, //determines which column is affected by this orderable: false //makes it so this column is not sortable asc or desc }, { "targets": 0, "data": "Test", //Used to make the first column a picture with a link to the edit form. Link is put inside each row using the GenerateTableFromJson function. "render": function (Test, type, full) { return "<a href='" + Test + "'>" + "<img border='0' height='22px' src='https://ksn2.faa.gov/apl/international/Reporting/PublishingImages/xsn_icon.JPG' alt='Edit'/>" + "</a>"; } }, { "targets": 13, "render": $.fn.dataTable.render.ellipsis(200) //Truncates the specifed row and the specified number which right now is 150. So if you want longer ones just increase the bigger number //NEED TO IMPORT ELLIPSIS.JS for this to work } ]
General Help with DataTables Styles

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.