Skip to content

Commit

Permalink
fix(DatatableV2): fix missing sorting indicator
Browse files Browse the repository at this point in the history
If consumer disables the column actions menu the sortion indicator was lost as we have it in the column actions button. This PR adds the separate sorting indicator for cases when the columns actions menu is disabled.

Closes UXD-1644
  • Loading branch information
ajkl2533 committed Oct 14, 2024
1 parent 4950fd3 commit b21a18d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/DatatableV2/header/HeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Inline } from '../../layout';
import { Tooltip } from '../../Tooltip';
import { displayColumnIds } from '../hooks/useDisplayColumns';
import { parseFromValuesOrFunc } from '../utils';
import { Icon } from '../../Icon';

const getTextHeaderStyle = (
labelLength: number | undefined,
Expand Down Expand Up @@ -43,6 +44,7 @@ const HeaderCell = <D,>({
headerComponent,
renderHeaderTooltip,
} = columnDef;
const direction = getIsSorted();

const showColumnActions =
(enableColumnActions || cdEnableColumnActions) &&
Expand Down Expand Up @@ -96,9 +98,17 @@ const HeaderCell = <D,>({
</button>
</Tooltip>
</Inline>
{showColumnActions && (
{showColumnActions ? (
<HeaderCellColumnActionsButton header={header} table={table} />
)}
) : direction !== false ? (
<div className="ds-table-header-cell-column-actions-button-wrapper">
<Icon
name={direction === 'asc' ? 'sort-up' : 'sort-down'}
size="sm"
hasFixedSize
/>
</div>
) : null}
{getCanResize() && (
<HeaderCellResizeHandler header={header} table={table} />
)}
Expand Down

0 comments on commit b21a18d

Please sign in to comment.