mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
a2935c6620
This MR also loads datatables.js globally (as it's required by the modal), so I removed it everywhere in code, and it shouldn't be used anymore (e.g. '//= require datatables'). Closes SCI-892.
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
$(document).on('click', '.sample-info-link', function(e) {
|
|
var that = $(this);
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: that.attr('href'),
|
|
dataType: 'json'
|
|
}).done(function(xhr, settings, data) {
|
|
$('body').append($.parseHTML(data.responseJSON.html));
|
|
$('#modal-info-sample').modal('show', {
|
|
backdrop: true,
|
|
keyboard: false
|
|
}).on('hidden.bs.modal', function() {
|
|
$(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);
|
|
}
|
|
});
|
|
});
|
|
e.preventDefault();
|
|
return false;
|
|
});
|
|
})();
|