diff --git a/app/assets/javascripts/samples/sample_datatable.js b/app/assets/javascripts/samples/sample_datatable.js index 0860f48ba..87d19eea4 100644 --- a/app/assets/javascripts/samples/sample_datatable.js +++ b/app/assets/javascripts/samples/sample_datatable.js @@ -163,9 +163,9 @@ function updateDataTableSelectAllCtrl(table){ } // Handle click on table cells with checkboxes -// $('#samples').on('click', 'tbody td, thead th:first-child', function(e){ -// $(this).parent().find('input[type="checkbox"]').trigger('click'); -// }); +$('#samples').on('click', 'tbody td, thead th:first-child', function(e){ + $(this).parent().find('input[type="checkbox"]').trigger('click'); +}); // Handle clicks on checkbox $("#samples tbody").on("click", "input[type='checkbox']", function(e){ @@ -281,28 +281,50 @@ table.on('draw', function(){ //Show sample info function sampleInfoListener() { - $(".sample_info") - .on("click", function(){ + $(".sample_info").on("click", function(e){ var that = $(this); $.ajax({ method: "GET", url: that.attr("data-href") + '.json', dataType: "json" }).done(function(xhr, settings, data) { - $("body") - .append($.parseHTML(data.responseJSON.html)); + $("body").append($.parseHTML(data.responseJSON.html)); $("#modal-info-sample").modal('show',{ - backdrop: true, - keyboard: false, + backdrop: true, + keyboard: false, }).on('hidden.bs.modal', function () { - $(this).remove(); + $(this).find(".modal-body #sample-info-table").DataTable().destroy(); + $(this).remove(); + }); + + $('#sample-info-table').DataTable({ + dom: "RBltpi", + stateSave: false, + buttons: [], + processing: true, + colReorder: { + fixedColumnsLeft: 1000000 // Disable reordering + }, + columnDefs: [{ + targets: 0, + searchable: false, + orderable: false + }], + fnDrawCallback: function(settings, json) { + animateSpinner(this, false); + }, + preDrawCallback: function(settings) { + animateSpinner(this); + } }); }).fail(function(error){ // TODO }).always(function(data){ // TODO }) - }) + e.preventDefault(); + return false; + }) }; // Edit sample diff --git a/app/views/samples/_info_sample_modal.html.erb b/app/views/samples/_info_sample_modal.html.erb index 43615a491..d08ed9f98 100644 --- a/app/views/samples/_info_sample_modal.html.erb +++ b/app/views/samples/_info_sample_modal.html.erb @@ -6,13 +6,43 @@ -<% byebug %> +