Remove unnecessary code

Removed check and just always destroy and rebuild datatables.
pull/87/head
Justin Gray 2016-01-20 20:33:59 -06:00
parent 22c2f659e8
commit 0bdc4a751d
1 changed files with 8 additions and 21 deletions

View File

@ -112,27 +112,14 @@ 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 attachmentsTable = $('#attachmentsTable').DataTable({
if ( $.fn.dataTable.isDataTable('#attachmentsTable') ) { destroy: true,
attachmentsTable = $('#attachmentsTable').DataTable({ "order": [[ 1, "asc" ]],
destroy: true, columnDefs: [
"order": [[ 1, "asc" ]], { orderable: false, targets: "no-sort" },
columnDefs: [ { sClass: "datatable_hidden", targets:[3,4]}
{ 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]}
]
});
}
var template = {attachments:[]} var template = {attachments:[]}
if (idx != -1) { if (idx != -1) {
template = templates[idx] template = templates[idx]