Skip to content

Commit f7ab347

Browse files
authored
Merge pull request #8139 from IgniteUI/ddincheva/selectionHGrid-master
Enhance multi-cell selection in hierarchical grid -- master
2 parents 3d5e9bf + a2c15ed commit f7ab347

File tree

4 files changed

+424
-4
lines changed

4 files changed

+424
-4
lines changed

projects/igniteui-angular/src/lib/grids/cell.component.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,10 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
755755
* @internal
756756
*/
757757
pointerenter = (event: PointerEvent) => {
758+
const isHierarchicalGrid = this.grid.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid';
759+
if (isHierarchicalGrid && (!this.grid.navigation.activeNode.gridID || this.grid.navigation.activeNode.gridID !== this.gridID)) {
760+
return;
761+
}
758762
const dragMode = this.selectionService.pointerEnter(this.selectionNode, event);
759763
if (dragMode) {
760764
this.grid.cdr.detectChanges();
@@ -766,7 +770,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
766770
* @internal
767771
*/
768772
pointerup = (event: PointerEvent) => {
769-
if (!isLeftClick(event)) { return; }
773+
const isHierarchicalGrid = this.grid.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid';
774+
if (!isLeftClick(event) || (isHierarchicalGrid && (!this.grid.navigation.activeNode.gridID ||
775+
this.grid.navigation.activeNode.gridID !== this.gridID))) { return; }
770776
if (this.selectionService.pointerUp(this.selectionNode, this.grid.onRangeSelection)) {
771777
this.grid.cdr.detectChanges();
772778
}

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-cell.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ export class IgxHierarchicalGridCellComponent extends IgxGridCellComponent imple
4545
// TODO: Extend the new selection service to avoid complete traversal
4646
_clearAllHighlights() {
4747
[this._rootGrid, ...this._rootGrid.getChildGrids(true)].forEach(grid => {
48-
grid.selectionService.clear();
4948
if (grid !== this.grid && grid.navigation.activeNode) {
5049
grid.navigation.clearActivation();
50+
grid.selectionService.initKeyboardState();
51+
grid.selectionService.clear();
5152
}
5253

5354
grid.selectionService.activeElement = null;
@@ -79,6 +80,7 @@ export class IgxHierarchicalGridCellComponent extends IgxGridCellComponent imple
7980
const parentRowID = parentGrid.hgridAPI.getParentRowId(childGrid);
8081
parentGrid.highlightedRowID = parentRowID;
8182
}
83+
this.grid.navigation.activeNode.gridID = this.gridID;
8284
super.activate(event);
8385
}
8486
}

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-navigation.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
240240
const nextColumnIndex = columnIndex <= lastVisibleIndex ? columnIndex : lastVisibleIndex;
241241
this._pendingNavigation = true;
242242
const cbFunc = (args) => {
243-
args.target.grid.tbody.nativeElement.focus();
244243
this._pendingNavigation = false;
245244
cb(args);
245+
args.target.grid.tbody.nativeElement.focus();
246246
};
247247
this.grid.parent.navigation.navigateInBody(targetRowIndex, nextColumnIndex, cbFunc);
248248
}

0 commit comments

Comments
 (0)