Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pivotGrid): row dimension header sort with kb interaction #14379

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { HEADER_KEYS, ROW_COLLAPSE_KEYS, ROW_EXPAND_KEYS } from '../../core/util
import { PivotUtil } from './pivot-util';
import { IgxPivotRowDimensionMrlRowComponent } from './pivot-row-dimension-mrl-row.component';
import { IMultiRowLayoutNode } from '../public_api';
import { SortingDirection } from '../../data-operations/sorting-strategy';
import { PivotUtil } from './pivot-util';
import { take, timeout } from 'rxjs';


@Injectable()
export class IgxPivotGridNavigationService extends IgxGridNavigationService {
public override grid: IgxPivotGridComponent;
Expand Down Expand Up @@ -174,6 +175,23 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
layout: null
}

if (ctrl) {
const dimIndex = this.activeNode.column;
const flatRowDimensions = PivotUtil.flatten(this.grid.visibleRowDimensions)
IMinchev64 marked this conversation as resolved.
Show resolved Hide resolved
const dim = flatRowDimensions[dimIndex];
if (this.activeNode.row === -1) {
if (key.includes('down') || key.includes('up')) {
let newSortDirection = SortingDirection.None;
if (key.includes('down')) {
newSortDirection = (dim.sortDirection === SortingDirection.Desc) ? SortingDirection.None : SortingDirection.Desc;
} else if (key.includes('up')) {
newSortDirection = (dim.sortDirection === SortingDirection.Asc) ? SortingDirection.None : SortingDirection.Asc;
}
this.grid.sortDimension(dim, newSortDirection);
return;
}
}
}
if ((key.includes('left') || key === 'home') && this.activeNode.column > 0) {
newActiveNode.column = ctrl || key === 'home' ? 0 : this.activeNode.column - 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
(pointerdown)="pointerdown($event)"
[igxColumnMovingDrop]="column"
[column]="column"
(keydown)="grid.navigation.headerNavigation($event)"
>
</igx-pivot-row-dimension-header>
<span *ngIf="!column.columnGroup && column.resizable" class="igx-grid-th__resize-handle"
Expand Down
Loading