Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

initialize tablesorter on initial load of report table as well

ulfertsa933b3245fd9
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
index 6a77bc7d530..9f0176c8c6e 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/hierarchy/single-hierarchy-row-builder.ts
@@ -126,7 +126,7 @@ export class SingleHierarchyRowBuilder extends SingleRowBuilder {
.addClass('-with-hierarchy')
.prepend(hierarchyElement);
- // Assure that the content is still visble when the hierarchy indentation is very large
+ // Assure that the content is still visible when the hierarchy indentation is very large
jRow.find('td.subject').css('minWidth', 125 + (hierarchyIndentation * hierarchyLevel) + 'px');
jRow.find('td.subject .wp-table--cell-container')
.css('width', 'calc(100% - ' + hierarchyBaseIndentation + 'px - ' + (hierarchyIndentation * hierarchyLevel) + 'px)');
diff --git a/frontend/src/app/modules/reporting/reporting-page/functionality/tablesorter.ts b/frontend/src/app/modules/reporting/reporting-page/functionality/tablesorter.ts
index e2146bbdc86..548a4d35d3e 100644
--- a/frontend/src/app/modules/reporting/reporting-page/functionality/tablesorter.ts
+++ b/frontend/src/app/modules/reporting/reporting-page/functionality/tablesorter.ts
@@ -3,32 +3,41 @@ import 'tablesorter';
/**
* Ported from legacy asset pipeline reporting
*/
-export function registerTableSorter() {
- jQuery(document).ajaxComplete(function () {
- // This prevents the tablesorter plugin to check for metadata which is done
- // using eval which conflicts with our csp.
- // Works because of a check in tablesorter:
- // meta = $.metadata ? $header.metadata() : false;
- jQuery.metadata = undefined;
- // Override the default texts to enable translations
- jQuery.tablesorter.language = {
- sortAsc: I18n.t('js.sort.sorted_asc'),
- sortDesc: I18n.t('js.sort.sorted_dsc'),
- sortNone: I18n.t('js.sort.sorted_no'),
- sortDisabled: I18n.t('js.sort.sorting_disabled'),
- nextAsc: I18n.t('js.sort.activate_asc'),
- nextDesc: I18n.t('js.sort.activate_dsc'),
- nextNone: I18n.t('js.sort.activate_no')
- };
+function initTableSorter() {
+ // This prevents the tablesorter plugin to check for metadata which is done
+ // using eval which conflicts with our csp.
+ // Works because of a check in tablesorter:
+ // meta = $.metadata ? $header.metadata() : false;
+ jQuery.metadata = undefined;
+
+ // Override the default texts to enable translations
+ jQuery.tablesorter.language = {
+ sortAsc: I18n.t('js.sort.sorted_asc'),
+ sortDesc: I18n.t('js.sort.sorted_dsc'),
+ sortNone: I18n.t('js.sort.sorted_no'),
+ sortDisabled: I18n.t('js.sort.sorting_disabled'),
+ nextAsc: I18n.t('js.sort.activate_asc'),
+ nextDesc: I18n.t('js.sort.activate_dsc'),
+ nextNone: I18n.t('js.sort.activate_no')
+ };
+
+ jQuery('#sortable-table')
+ .not('.tablesorter')
+ .tablesorter({
+ sortList: [[0, 0]],
+ textExtraction: function (node:HTMLElement, table:any, cellIndex:any) {
+ return node.getAttribute('raw-data');
+ }
+ });
+}
- jQuery('#sortable-table')
- .not('.tablesorter')
- .tablesorter({
- sortList: [[0, 0]],
- textExtraction: function (node:HTMLElement, table:any, cellIndex:any) {
- return node.getAttribute('raw-data');
- }
- });
+export function registerTableSorter() {
+ jQuery(document).ready(function () {
+ initTableSorter();
+ });
+
+ jQuery(document).ajaxComplete(function () {
+ initTableSorter();
});
}