diff --git a/static/js/app/templates.js b/static/js/app/templates.js index 85ece065..48dd0f1c 100644 --- a/static/js/app/templates.js +++ b/static/js/app/templates.js @@ -78,7 +78,14 @@ function deleteTemplate(idx){ } function attach(files){ - attachmentsTable = $("#attachmentsTable").DataTable(); + attachmentsTable = $("#attachmentsTable").DataTable({ + destroy: true, + "order": [[ 1, "asc" ]], + columnDefs: [ + { orderable: false, targets: "no-sort" }, + { sClass: "datatable_hidden", targets:[3,4]} + ] + }); $.each(files, function(i, file){ var reader = new FileReader(); /* Make this a datatable */ @@ -107,14 +114,23 @@ function edit(idx){ $("#attachmentsTable").show() attachmentsTable = null if ( $.fn.dataTable.isDataTable('#attachmentsTable') ) { - attachmentsTable = $('#attachmentsTable').DataTable(); + attachmentsTable = $('#attachmentsTable').DataTable({ + destroy: true, + "order": [[ 1, "asc" ]], + columnDefs: [ + { orderable: false, targets: "no-sort" }, + { sClass: "datatable_hidden", targets:[3,4]} + ] + }); } else { attachmentsTable = $("#attachmentsTable").DataTable({ - "aoColumnDefs" : [{ - "targets" : [3,4], - "sClass" : "datatable_hidden" - }] + destroy: true, + "order": [[ 1, "asc" ]], + columnDefs: [ + { orderable: false, targets: "no-sort" }, + { sClass: "datatable_hidden", targets:[3,4]} + ] }); } var template = {attachments:[]} diff --git a/templates/templates.html b/templates/templates.html index ac84b37f..5be682f1 100644 --- a/templates/templates.html +++ b/templates/templates.html @@ -102,11 +102,11 @@ - + - - - + + +
NameContentTypeContentType