Fixed the attachments table

Fixed the sorting on the attachments table, there could be opportunity
to clean this up a little.
pull/87/head
Justin Gray 2016-01-20 19:42:41 -06:00
parent b9fd654f8a
commit 22c2f659e8
2 changed files with 26 additions and 10 deletions

View File

@ -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:[]}

View File

@ -102,11 +102,11 @@
<table id="attachmentsTable" class="table">
<thead>
<tr>
<th class="col-md-1"></th>
<th class="col-md-1 no-sort"></th>
<th class="col-md-10">Name</th>
<th class="col-md-1"></th>
<th class="datatable_hidden">Content</th>
<th class="datatable_hidden">Type</th>
<th class="col-md-1 no-sort"></th>
<th class="datatable_hidden no-sort">Content</th>
<th class="datatable_hidden no-sort">Type</th>
</tr>
</thead>
<tbody>