Skip to content

Commit 10cd985

Browse files
committed
fix(IgxGrid): add method to check for menu pinning actions in action strip
1 parent de60460 commit 10cd985

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ import { getCurrentResourceStrings } from '../core/i18n/resources';
186186
import { isTree, recreateTree, recreateTreeFromFields } from '../data-operations/expressions-tree-util';
187187
import { getUUID } from './common/random';
188188
import { DefaultMergeStrategy, IGridMergeStrategy } from '../data-operations/merge-strategy';
189+
import { IgxActionStripComponent, IgxGridPinningActionsComponent } from 'igniteui-angular';
189190

190191
interface IMatchInfoCache {
191192
row: any;
@@ -7836,7 +7837,7 @@ export abstract class IgxGridBaseDirective implements GridType,
78367837
const keepActionStrip =
78377838
!!context?.pinned &&
78387839
!!contextEl?.isConnected &&
7839-
!(this.actionStrip?.menuItems?.length > 0);
7840+
!this.hasMenuPinningActions();
78407841

78417842
if (!keepActionStrip) {
78427843
if (this.actionStrip) {
@@ -7852,6 +7853,22 @@ export abstract class IgxGridBaseDirective implements GridType,
78527853
this.gridScroll.emit(args);
78537854
}
78547855

7856+
protected hasMenuPinningActions(): boolean {
7857+
const strip = this.actionStrip as IgxActionStripComponent;
7858+
if (!strip?.actionButtons?.length) {
7859+
return false;
7860+
}
7861+
7862+
let hasMenuPinningActions = false;
7863+
strip.actionButtons.forEach((button) => {
7864+
if (button instanceof IgxGridPinningActionsComponent && button.asMenuItems) {
7865+
hasMenuPinningActions = true;
7866+
}
7867+
});
7868+
7869+
return hasMenuPinningActions;
7870+
}
7871+
78557872
protected horizontalScrollHandler(event) {
78567873
const scrollLeft = event.target.scrollLeft;
78577874
this.headerContainer.onHScroll(scrollLeft);

0 commit comments

Comments
 (0)