mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 02:22:00 +08:00
feat: enale temporary sorting on table panel type (#5114)
This commit is contained in:
parent
6aded04b7f
commit
0760917a4b
@ -7,7 +7,7 @@ import {
|
|||||||
import { FORMULA_REGEXP } from 'constants/regExp';
|
import { FORMULA_REGEXP } from 'constants/regExp';
|
||||||
import { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
|
import { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
|
||||||
import { QueryTableProps } from 'container/QueryTable/QueryTable.intefaces';
|
import { QueryTableProps } from 'container/QueryTable/QueryTable.intefaces';
|
||||||
import { isEqual, isObject } from 'lodash-es';
|
import { isEqual, isNaN, isObject } from 'lodash-es';
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
import {
|
import {
|
||||||
IBuilderFormula,
|
IBuilderFormula,
|
||||||
@ -460,6 +460,18 @@ const generateTableColumns = (
|
|||||||
title: item.title,
|
title: item.title,
|
||||||
width: QUERY_TABLE_CONFIG.width,
|
width: QUERY_TABLE_CONFIG.width,
|
||||||
render: renderColumnCell && renderColumnCell[item.dataIndex],
|
render: renderColumnCell && renderColumnCell[item.dataIndex],
|
||||||
|
sorter: (a: RowData, b: RowData): number => {
|
||||||
|
const valueA = Number(a[item.dataIndex]);
|
||||||
|
const valueB = Number(b[item.dataIndex]);
|
||||||
|
|
||||||
|
if (!isNaN(valueA) && !isNaN(valueB)) {
|
||||||
|
return valueA - valueB;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((a[item.dataIndex] as string) || '').localeCompare(
|
||||||
|
(b[item.dataIndex] as string) || '',
|
||||||
|
);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return [...acc, column];
|
return [...acc, column];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user