Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dojo/templates/dojo/finding_groups_list_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ <h3 class="has-filters">
};

$(document).ready(function() {
// Disable DataTables' client-side ordering on columns that sort server-side via dojo_sort
// (?o=), so a header click does ONE sort (server reload) instead of an instant client
// re-sort that "flashes" before the reload. (upstream issue #1811)
var serverSortDataKeys = new Set(['name', 'findings_count', 'creator', 'sla_deadline']);
var serverSortTargets = [];
for (var i = 0; i < datatables_columns.length; i++) {
if (serverSortDataKeys.has(datatables_columns[i]["data"])) { serverSortTargets.push(i); }
}
$('#open_finding_groups').DataTable({
drawCallback: function(){
$('#open_finding_groups .has-popover').hover(
Expand All @@ -183,6 +191,10 @@ <h3 class="has-filters">
columns: datatables_columns,
order: [],
columnDefs: [
{
orderable: false,
targets: serverSortTargets
},
{
targets: 'severity-sort',
orderDataType: 'severity-asc'
Expand Down
9 changes: 6 additions & 3 deletions dojo/templates/dojo/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,12 @@ <h3 class="has-filters">
},
colReorder: true,
autoWidth: false,
// Columns whose headers render server-side sort links (dojo_sort -> ?o=) must NOT
// also be client-sortable by DataTables, or a header click triggers an instant client
// re-sort that "flashes" right before the server reload redraws. (upstream issue #1811)
"columns": [
{ "data": "action", "searchable": false },
{ "data": "product" },
{ "data": "product", "orderable": false },
{ "data": "tags" },
{ "data": "criticality" , render: function (data, type, row) {
const criticals = {
Expand Down Expand Up @@ -381,10 +384,10 @@ <h3 class="has-filters">
return type === 'export' ? getDojoExportValueFromTag(data, 'i', 'data-content') : data;
}},
{% endif %}
{ "data": "findings" },
{ "data": "findings", "orderable": false },
{ "data": "locations" },
{ "data": "contacts" },
{ "data": "product_type" },
{ "data": "product_type", "orderable": false },
],
order: [],
columnDefs: [
Expand Down
12 changes: 12 additions & 0 deletions dojo/templates_classic/dojo/finding_groups_list_snippet.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,14 @@ <h3 class="has-filters">
};

$(document).ready(function() {
// Disable DataTables' client-side ordering on columns that sort server-side via dojo_sort
// (?o=), so a header click does ONE sort (server reload) instead of an instant client
// re-sort that "flashes" before the reload. (upstream issue #1811)
var serverSortDataKeys = new Set(['name', 'findings_count', 'creator', 'sla_deadline']);
var serverSortTargets = [];
for (var i = 0; i < datatables_columns.length; i++) {
if (serverSortDataKeys.has(datatables_columns[i]["data"])) { serverSortTargets.push(i); }
}
$('#open_finding_groups').DataTable({
drawCallback: function(){
$('#open_finding_groups .has-popover').hover(
Expand All @@ -183,6 +191,10 @@ <h3 class="has-filters">
columns: datatables_columns,
order: [],
columnDefs: [
{
orderable: false,
targets: serverSortTargets
},
{
targets: 'severity-sort',
orderDataType: 'severity-asc'
Expand Down
9 changes: 6 additions & 3 deletions dojo/templates_classic/dojo/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,12 @@ <h3 class="has-filters">
},
colReorder: true,
autoWidth: false,
// Columns whose headers render server-side sort links (dojo_sort -> ?o=) must NOT
// also be client-sortable by DataTables, or a header click triggers an instant client
// re-sort that "flashes" right before the server reload redraws. (upstream issue #1811)
"columns": [
{ "data": "action", "searchable": false },
{ "data": "product" },
{ "data": "product", "orderable": false },
{ "data": "tags" },
{ "data": "criticality" , render: function (data, type, row) {
const criticals = {
Expand Down Expand Up @@ -381,10 +384,10 @@ <h3 class="has-filters">
return type === 'export' ? getDojoExportValueFromTag(data, 'i', 'data-content') : data;
}},
{% endif %}
{ "data": "findings" },
{ "data": "findings", "orderable": false },
{ "data": "locations" },
{ "data": "contacts" },
{ "data": "product_type" },
{ "data": "product_type", "orderable": false },
],
order: [],
columnDefs: [
Expand Down
Loading