mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 05:41:59 +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 { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
|
||||
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 {
|
||||
IBuilderFormula,
|
||||
@ -460,6 +460,18 @@ const generateTableColumns = (
|
||||
title: item.title,
|
||||
width: QUERY_TABLE_CONFIG.width,
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user