Skip to content

Commit 7295941

Browse files
committed
feat(igxGrid): fix dragGhost display #1607
1 parent 03dc7a8 commit 7295941

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

projects/igniteui-angular/src/lib/grid/grid-header.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { DataType } from '../data-operations/data-util';
1717
import { SortingDirection } from '../data-operations/sorting-expression.interface';
1818
import { RestrictDrag } from '../directives/dragdrop/dragdrop.directive';
1919
import { IgxGridAPIService } from './api.service';
20-
import { IgxGridCellComponent } from './cell.component';
2120
import { IgxColumnComponent } from './column.component';
2221
import { autoWire, IGridBus, IgxColumnMovingService } from './grid.common';
2322

@@ -153,6 +152,7 @@ export class IgxGridHeaderComponent implements IGridBus, OnInit, DoCheck, AfterV
153152
@HostListener('click', ['$event'])
154153
@autoWire(true)
155154
public onClick(event) {
155+
156156
if (!this.column.grid.isColumnResizing) {
157157
event.stopPropagation();
158158
if (this.column.sortable) {
@@ -187,7 +187,8 @@ export class IgxGridHeaderComponent implements IGridBus, OnInit, DoCheck, AfterV
187187
const actualWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
188188

189189
if (this.column.pinned) {
190-
const pinnedMaxWidth = this._pinnedMaxWidth = this.grid.calcPinnedContainerMaxWidth - this.grid.pinnedWidth + actualWidth;
190+
const pinnedMaxWidth = this._pinnedMaxWidth =
191+
this.grid.calcPinnedContainerMaxWidth - this.grid.getPinnedWidth(true) + actualWidth;
191192

192193
if (this.column.maxWidth && parseFloat(this.column.maxWidth) < pinnedMaxWidth) {
193194
this._pinnedMaxWidth = this.column.maxWidth;
@@ -298,7 +299,7 @@ export class IgxGridHeaderComponent implements IGridBus, OnInit, DoCheck, AfterV
298299
const size = Math.ceil(largestCell + largestCellPadding) + 'px';
299300

300301
if (this.column.pinned) {
301-
const newPinnedWidth = this.grid.pinnedWidth - currentColWidth + parseFloat(size);
302+
const newPinnedWidth = this.grid.getPinnedWidth(true) - currentColWidth + parseFloat(size);
302303

303304
if (newPinnedWidth <= this.grid.calcPinnedContainerMaxWidth) {
304305
this.column.width = size;

projects/igniteui-angular/src/lib/grid/grid.common.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@ export class IgxColumnMovingDragDirective extends IgxDragDirective {
322322

323323
this._dragGhost.style.height = null;
324324
this._dragGhost.style.minWidth = null;
325-
this._dragGhost.style.flexBasis = null;
325+
this._dragGhost.style.flexBasis = null;
326+
this._dragGhost.style.position = null;
326327

327328
const icon = document.createElement('i');
328329
const text = document.createTextNode('block');
@@ -415,7 +416,7 @@ export class IgxColumnMovingDropDirective extends IgxDropDirective implements On
415416
}
416417

417418
if (!this.cms.column.pinned && this.column.pinned) {
418-
const nextPinnedWidth = this.column.grid.getPinnedWidth() + parseFloat(this.cms.column.width);
419+
const nextPinnedWidth = this.column.grid.getPinnedWidth(true) + parseFloat(this.cms.column.width);
419420

420421
if (nextPinnedWidth <= this.column.grid.calcPinnedContainerMaxWidth) {
421422
this.cms.icon.innerText = 'lock';
@@ -469,7 +470,7 @@ export class IgxColumnMovingDropDirective extends IgxDropDirective implements On
469470

470471
let nextPinnedWidth;
471472
if (this.column.pinned && !this.cms.column.pinned) {
472-
nextPinnedWidth = this.column.grid.getPinnedWidth() + parseFloat(this.cms.column.width);
473+
nextPinnedWidth = this.column.grid.getPinnedWidth(true) + parseFloat(this.cms.column.width);
473474
}
474475

475476
if ((nextPinnedWidth && nextPinnedWidth > this.column.grid.calcPinnedContainerMaxWidth) ||
@@ -482,7 +483,7 @@ export class IgxColumnMovingDropDirective extends IgxDropDirective implements On
482483

483484
let col;
484485
const selectedCells = this.cms.column.grid.selectedCells;
485-
if (selectedCells && this.cms.column.grid.selectedCells.length > 0) {
486+
if (selectedCells && selectedCells.length > 0) {
486487
col = selectedCells[0].column;
487488
}
488489

0 commit comments

Comments
 (0)