(dragleave)="onColumnDragLeave($event, col)"
[ngClass]="{'dragover' : col.isDragTarget}"
class="eg-grid-cell eg-grid-header-cell" [ngStyle]="{flex:col.flex}">
- <a class="sortable" *ngIf="col.isSortable" (click)="sortOneColumn(col)">
- {{col.label}}
+ <a class="sortable label-with-material-icon" *ngIf="col.isSortable"
+ (click)="sortOneColumn(col)">
+ <span class="eg-grid-header-cell-sort-label">{{col.label}}</span>
+ <span class="material-icons eg-grid-header-cell-sort-arrow"
+ *ngIf="isColumnSorting(col, 'ASC')">arrow_downwards</span>
+ <span class="material-icons eg-grid-header-cell-sort-arrow"
+ *ngIf="isColumnSorting(col, 'DESC')">arrow_upwards</span>
</a>
<span *ngIf="!col.isSortable">{{col.label}}</span>
</div>
this.dataSource.sort = [{name: col.name, dir: dir}];
this.grid.reload();
}
+
+ // Returns true if the provided column is sorting in the
+ // specified direction.
+ isColumnSorting(col: EgGridColumn, dir: string): boolean {
+ let sort = this.dataSource.sort.filter(c => c.name == col.name)[0];
+ return sort && sort.dir == dir;
+ }
}
border-color: #b8daff;
}
-.eg-grid-header-cell a.sortable {
+/*
+.eg-grid-header-cell a.sortable span {
+*/
+.eg-grid-header-cell-sort-label {
cursor: pointer;
color: #007bff;
text-decoration:underline;
}
+.eg-grid-header-cell-sort-arrow {
+ font-size: 14px;
+}
+
.eg-grid-cell {
flex: 1; /* applied per column */
padding: 6px;