#66 fix clickable header behaviour for special cases

This commit is contained in:
Denys Vuika 2016-05-17 16:27:05 +01:00
parent 4cf31f0d1e
commit 5319726a22
2 changed files with 7 additions and 2 deletions

View File

@ -8,8 +8,9 @@
<thead>
<tr>
<!-- Columns -->
<th class="mdl-data-table__cell--non-numeric column-header {{col.cssClass}}"
<th class="mdl-data-table__cell--non-numeric {{col.cssClass}}"
*ngFor="#col of columns"
[class.column-header]="col.title"
[class.mdl-data-table__header--sorted-ascending]="sorting.key === col.source && sorting.direction === 'asc'"
[class.mdl-data-table__header--sorted-descending]="sorting.key === col.source && sorting.direction === 'desc'"
(click)="onColumnHeaderClick(col)">

View File

@ -332,7 +332,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
}
onColumnHeaderClick(column: ContentColumnModel) {
if (column) {
if (column && this._isSortableColumn(column)) {
if (this.sorting.key === column.source) {
this.sorting.direction = this.sorting.direction === 'asc' ? 'desc' : 'asc';
} else {
@ -368,4 +368,8 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit
private _hasEntries(node: NodePaging): boolean {
return (node && node.list && node.list.entries && node.list.entries.length > 0);
}
private _isSortableColumn(column: ContentColumnModel) {
return column && column.source && !column.source.startsWith('$');
}
}