mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-15 23:45:54 +00:00
71 lines
2.2 KiB
JavaScript
71 lines
2.2 KiB
JavaScript
$(document).ready(function () {
|
|
var table = $('#file-table').DataTable({
|
|
"paging": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"info": true,
|
|
"select.items": "row",
|
|
"pageLength": 25,
|
|
"columnDefs": [{
|
|
"targets": 8,
|
|
"orderable": false
|
|
}],
|
|
//"language": {
|
|
// "lengthMenu": "_MENU_"
|
|
//}
|
|
});
|
|
// Check if row is selected
|
|
$('#file-table tbody').on('click', 'tr', function () {
|
|
if ($(this).hasClass('{{ selected }}')) {
|
|
$(this).removeClass('{{ selected }}');
|
|
} else {
|
|
table.$('tr.{{ selected }}').removeClass('{{ selected }}');
|
|
$(this).addClass('{{ selected }}');
|
|
}
|
|
});
|
|
// Show file with doubleclick
|
|
$('#file-table tbody').on('dblclick', 'tr', function () {
|
|
showFile($(this).attr("id"));
|
|
});
|
|
$(document).ajaxStart(function(){
|
|
$("body").addClass('ajaxLoading');
|
|
});
|
|
$(document).ajaxStop(function(){
|
|
$("body").removeClass('ajaxLoading');
|
|
});
|
|
});
|
|
function showFile(selectedFile) {
|
|
var form = $('<form action="/show" method="post">' +
|
|
'<input type="hidden" name="selected-file" value="' + selectedFile + '" />' +
|
|
'<input type="hidden" name="compare" value='+$("#compare").is(':checked')+' />' +
|
|
'</form>');
|
|
$('body').append(form);
|
|
form.submit();
|
|
}
|
|
function excel() {
|
|
var checkbox = document.getElementsByName("selected_files");
|
|
var selectedFiles = [];
|
|
for (var i = 0; i < checkbox.length; i++) {
|
|
if (checkbox[i].checked) {
|
|
selectedFiles.push(checkbox[i].value);
|
|
}
|
|
}
|
|
if (selectedFiles.length == 0) {
|
|
alert("Select at least one file");
|
|
return;
|
|
}
|
|
var compare = $("#compare").is(':checked');
|
|
excelFiles(selectedFiles, compare);
|
|
}
|
|
function setCheckBoxes(value) {
|
|
var checkbox = document.getElementsByName("selected_files");
|
|
for (i = 0; i < checkbox.length; i++) {
|
|
checkbox[i].checked=value;
|
|
}
|
|
}
|
|
function redirectIndex(candidate){
|
|
location.href="/config/"+ candidate + "/" + $("#compare").is(':checked');
|
|
}
|
|
function redirectDatasets(){
|
|
location.href="/datasets/" + $("#compare").is(':checked');
|
|
} |