fix(table): use column label instead of SQL expression for orderby in downloads (#39332)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2026-04-15 11:20:54 -07:00
committed by GitHub
parent 8471e82342
commit b3e88db87e
2 changed files with 25 additions and 7 deletions

View File

@@ -90,7 +90,7 @@ describe('plugin-chart-ag-grid-table', () => {
},
).queries[0];
expect(query.orderby).toEqual([['degree_type', true]]);
expect(query.orderby).toEqual([['Highest Degree', true]]);
});
test('should map string metric colId to backend identifier', () => {
@@ -267,6 +267,25 @@ describe('plugin-chart-ag-grid-table', () => {
]);
});
test('should use label (not sqlExpression) for adhoc column in CSV export sortModel', () => {
const adhocColumn = createAdhocColumn('sales / 100', 'Margin');
const query = buildQuery(
{
...basicFormData,
groupby: [adhocColumn],
result_format: 'csv',
},
{
ownState: {
sortModel: [{ colId: 'Margin', sort: 'desc' }],
},
},
).queries[0];
expect(query.orderby?.[0]).toEqual(['Margin', false]);
});
test('should not add tie-breaker for non-download queries with server pagination', () => {
const query = buildQuery(
{