diff --git a/client/core/src/column-header/column-header.html b/client/core/src/column-header/column-header.html index 435057a19..d5747fcfe 100644 --- a/client/core/src/column-header/column-header.html +++ b/client/core/src/column-header/column-header.html @@ -1,5 +1,5 @@
- + {{::$ctrl.text}} diff --git a/client/core/src/column-header/column-header.js b/client/core/src/column-header/column-header.js index 2f5f4d3c3..4c52e7e3d 100644 --- a/client/core/src/column-header/column-header.js +++ b/client/core/src/column-header/column-header.js @@ -1,19 +1,25 @@ import {module} from '../module'; export default class ColumnHeader { - constructor() { + constructor($attrs) { this.order = undefined; this.mouseIsOver = false; + this.orderLocked = ($attrs.orderLocked !== undefined); } onClick() { - if (this.order === 'ASC') { - this.order = 'DESC'; - } else { - this.order = 'ASC'; + if (!this.orderLocked) { + if (this.order === 'ASC') { + this.order = 'DESC'; + } else { + this.order = 'ASC'; + } + this.gridHeader.selectColum(this); } - this.gridHeader.selectColum(this); } showArrow(type) { + if (this.orderLocked) + return false; + let showArrow = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order === type); let showOther = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order !== type); if (type === 'DESC' && this.mouseIsOver && !showOther) { @@ -22,13 +28,13 @@ export default class ColumnHeader { return showArrow; } $onInit() { - if (this.defaultOrder) { + if (this.defaultOrder && !this.orderLocked) { this.order = this.defaultOrder; this.onClick(); } } } -ColumnHeader.$inject = []; +ColumnHeader.$inject = ['$attrs']; module.component('vnColumnHeader', { template: require('./column-header.html'),