mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
Sort insights table total sum (#5521)
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
This commit is contained in:
parent
79e74aebba
commit
37f1498410
@ -146,7 +146,7 @@ export function InsightsTable({ isLegend = true, showTotalCount = false }: Insig
|
||||
if (showTotalCount) {
|
||||
columns.push({
|
||||
title: (
|
||||
<Dropdown overlay={calcColumnMenu} trigger={['click']}>
|
||||
<Dropdown overlay={calcColumnMenu}>
|
||||
<span className="cursor-pointer">
|
||||
{CALC_COLUMN_LABELS[calcColumnState]} <DownOutlined />
|
||||
</span>
|
||||
@ -163,11 +163,7 @@ export function InsightsTable({ isLegend = true, showTotalCount = false }: Insig
|
||||
filters.display === ACTIONS_TABLE ||
|
||||
filters.display === ACTIONS_PIE_CHART)
|
||||
) {
|
||||
// Special handling because `count` will contain the last amount, instead of the cumulative sum.
|
||||
return (
|
||||
item.aggregated_value?.toLocaleString() ||
|
||||
item.data.reduce((acc, val) => acc + val, 0).toLocaleString()
|
||||
)
|
||||
return (item.count || item.aggregated_value).toLocaleString()
|
||||
}
|
||||
return (
|
||||
<>
|
||||
@ -180,9 +176,11 @@ export function InsightsTable({ isLegend = true, showTotalCount = false }: Insig
|
||||
</>
|
||||
)
|
||||
},
|
||||
defaultSortOrder: 'descend',
|
||||
sorter: (a, b) => a.count - b.count,
|
||||
dataIndex: 'count',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
width: 120,
|
||||
align: 'center',
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user