Skip to content

Commit 8a5bc70

Browse files
ctruedenclaude
andcommitted
Fix sorttable column sorting of team table
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0c345a9 commit 8a5bc70

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/pombast/team/templates/team.html.j2

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ td.has-popup:hover { filter: brightness(1.3); }
3434
<span id="forkongithub"><a href="https://github.com/scijava/status.scijava.org">Fix me on GitHub</a></span>
3535
{{ header_html | safe }}
3636
<p id="generated" style="margin: 0.5em 1em; font-size: 0.85em; color: #555;"></p>
37-
<table class="sortable">
37+
<table id="team-table">
3838
<thead>
3939
<tr>
4040
<th>Team Member</th>
@@ -70,6 +70,7 @@ td.has-popup:hover { filter: brightness(1.3); }
7070
var modal = document.getElementById('team-modal');
7171
var titleEl = document.getElementById('team-title');
7272
var list = document.getElementById('team-list');
73+
var table = document.getElementById('team-table');
7374
var tbody = document.getElementById('team-body');
7475
7576
var COL_LABELS = {
@@ -163,12 +164,18 @@ td.has-popup:hover { filter: brightness(1.3); }
163164
if (data.generated) {
164165
document.getElementById('generated').textContent = 'Generated: ' + data.generated;
165166
}
166-
// Default view: highest total workload first. sorttable.js still re-sorts
167-
// on header clicks, reading the tbody rows fresh each time.
167+
// Default view: highest total workload first.
168168
var rows = (data.rows || []).slice().sort(function(a, b){ return b.total - a.total; });
169169
var frag = document.createDocumentFragment();
170170
rows.forEach(function(row){ frag.appendChild(buildRow(row)); });
171171
tbody.appendChild(frag);
172+
// Initialize sorttable now that the body is populated, so it detects the
173+
// numeric columns correctly (it guesses each column's type from the first
174+
// body row, which would be missing if it ran on the empty table at load).
175+
if (window.sorttable && typeof sorttable.makeSortable === 'function') {
176+
table.className = 'sortable';
177+
sorttable.makeSortable(table);
178+
}
172179
});
173180
})();
174181
</script>

0 commit comments

Comments
 (0)