Skip to content

Commit

Permalink
Attempt fix to formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Sep 3, 2024
1 parent 9027fec commit 2eef536
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions docs/_static/main.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
$(document).ready( function () {
document.querySelectorAll('.datatable:not(.centertable)').forEach(function(table) {
if (window.$ && $.fn.DataTable) {
$(table).DataTable({
paging: false,
searching: false,
});
}
$(table.datable).DataTable({
paging: false,
searching: false,
});
});

customTables = document.querySelectorAll('.datatable.centertable').forEach(function(table) {
if (window.$ && $.fn.DataTable) {
var tableInstance = $(table).DataTable({
columnDefs: [{
targets: '_all',
orderable: true
}],
order: [],
drawCallback: function() {
this.api().rows().nodes().to$().each(function(index) {
if (index < 6)
$(this).addClass('no-sort');
});
},
paging: false,
searching: false,
}).on('order.dt', function() {
tableInstance.column(0).order('no-sort').draw();
});
document.querySelectorAll('.datatable.centertable').forEach(function(table) {
var tableInstance = $(table.datable).DataTable({
columnDefs: [{
targets: '_all',
orderable: true
}],
order: [],
drawCallback: function() {
this.api().rows().nodes().to$().each(function(index) {
if (index < 6)
$(this).addClass('no-sort');
});
},
paging: false,
searching: false,
})

// Custom sorting behavior
$.fn.dataTable.ext.order['no-sort'] = function (_, _, dataIndex) {
if (dataIndex < 6)
return -1; // Force header and first 5 rows to be at the top
return 1;
};
}
tableInstance.on('order.dt', function() {
tableInstance.column(0).order('no-sort').draw();
});

// Custom sorting behavior
$.fn.dataTable.ext.order['no-sort'] = function (_, _, dataIndex) {
if (dataIndex < 6)
return -1; // Force header and first 5 rows to be at the top
return 1;
};
});
});

0 comments on commit 2eef536

Please sign in to comment.