我在物料表中实现列大小调整。我的问题是要对列进行排序。
const upFn = () => {
document.removeEventListener('mousemove', moveFn);
document.removeEventListener('mouseup', upFn);
this.inMove = false;
// How to prevent sorting here ?
};
答案 0 :(得分:0)
尝试一下:
<mat-header-cell
#headercell
(mousemove)="mousemove($event, i)"
(mousedown)="resizeTable($event, i)"
fxLayout="row"
fxLayoutAlign="space-between stretch"
[fxFlex]="column.width"
*matHeaderCellDef
[disabled]="isResizeActive"
>
<div fxFlex [disabled]="column.isSortable === false || isResizeActive" mat-sort-header>
{{ column.title || column.field }}
</div>
</mat-header-cell>
在您的方法中,只需将标志设置为true
:
const upFn = () => {
document.removeEventListener('mousemove', moveFn);
document.removeEventListener('mouseup', upFn);
this.inMove = false;
this.isResizeActive = true;
};