From 0bdc4a751d1a43bfed334f96017340bae822625d Mon Sep 17 00:00:00 2001 From: Justin Gray Date: Wed, 20 Jan 2016 20:33:59 -0600 Subject: [PATCH] Remove unnecessary code Removed check and just always destroy and rebuild datatables. --- static/js/app/templates.js | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/static/js/app/templates.js b/static/js/app/templates.js index 48dd0f1c..fb04e267 100644 --- a/static/js/app/templates.js +++ b/static/js/app/templates.js @@ -112,27 +112,14 @@ function edit(idx){ $("#attachmentUpload").unbind('click').click(function(){this.value=null}) $("#html_editor").ckeditor() $("#attachmentsTable").show() - attachmentsTable = null - if ( $.fn.dataTable.isDataTable('#attachmentsTable') ) { - attachmentsTable = $('#attachmentsTable').DataTable({ - destroy: true, - "order": [[ 1, "asc" ]], - columnDefs: [ - { orderable: false, targets: "no-sort" }, - { sClass: "datatable_hidden", targets:[3,4]} - ] - }); - } - else { - attachmentsTable = $("#attachmentsTable").DataTable({ - destroy: true, - "order": [[ 1, "asc" ]], - columnDefs: [ - { orderable: false, targets: "no-sort" }, - { sClass: "datatable_hidden", targets:[3,4]} - ] - }); - } + attachmentsTable = $('#attachmentsTable').DataTable({ + destroy: true, + "order": [[ 1, "asc" ]], + columnDefs: [ + { orderable: false, targets: "no-sort" }, + { sClass: "datatable_hidden", targets:[3,4]} + ] + }); var template = {attachments:[]} if (idx != -1) { template = templates[idx]