Remove unnecessary code

Removed check and just always destroy and rebuild datatables.
This commit is contained in:
Justin Gray 2016-01-20 20:33:59 -06:00
parent 22c2f659e8
commit 0bdc4a751d

View file

@ -112,8 +112,6 @@ function edit(idx){
$("#attachmentUpload").unbind('click').click(function(){this.value=null}) $("#attachmentUpload").unbind('click').click(function(){this.value=null})
$("#html_editor").ckeditor() $("#html_editor").ckeditor()
$("#attachmentsTable").show() $("#attachmentsTable").show()
attachmentsTable = null
if ( $.fn.dataTable.isDataTable('#attachmentsTable') ) {
attachmentsTable = $('#attachmentsTable').DataTable({ attachmentsTable = $('#attachmentsTable').DataTable({
destroy: true, destroy: true,
"order": [[ 1, "asc" ]], "order": [[ 1, "asc" ]],
@ -122,17 +120,6 @@ function edit(idx){
{ sClass: "datatable_hidden", targets:[3,4]} { 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]}
]
});
}
var template = {attachments:[]} var template = {attachments:[]}
if (idx != -1) { if (idx != -1) {
template = templates[idx] template = templates[idx]