@@ -35,14 +35,18 @@ import { TableColumnConfigExtended } from '../table.service';
3535 [htTooltip]="this.getTooltip(this.columnConfig.titleTooltip, this.columnConfig.title)"
3636 class="table-header-cell-renderer"
3737 >
38- <ng-container *ngIf="this.leftAlignFilterButton">
38+ <ng-container *ngIf="this.isShowOptionButton && this. leftAlignFilterButton">
3939 <ng-container *ngTemplateOutlet="optionsButton"></ng-container>
4040 </ng-container>
4141 <div class="title" [ngClass]="this.classes" (click)="this.onSortChange()">{{ this.columnConfig.title }}</div>
42- <ng-container *ngIf="!this.leftAlignFilterButton">
42+ <ng-container *ngIf="this.isShowOptionButton && !this.leftAlignFilterButton">
4343 <ng-container *ngTemplateOutlet="optionsButton"></ng-container>
4444 </ng-container>
4545
46+ <ng-template #htmlTooltip>
47+ <div [innerHTML]="this.columnConfig?.titleTooltip"></div>
48+ </ng-template>
49+
4650 <ng-template #optionsButton>
4751 <ht-popover class="options-button" [closeOnClick]="true">
4852 <ht-popover-trigger>
@@ -54,9 +58,9 @@ import { TableColumnConfigExtended } from '../table.service';
5458 <div [style.min-width.px]="trigger.offsetWidth" class="popover-content">
5559 <ng-container *ngIf="this.isFilterable">
5660 <div class="popover-item" (click)="this.onFilterValues()" *ngIf="this.isFilterable">Filter Values</div>
57- <div class="popover-item-divider" *ngIf="this.columnConfig.sortable !== false || this.editable"></div>
5861 </ng-container>
5962 <ng-container *ngIf="this.columnConfig.sortable !== false">
63+ <div class="popover-item-divider"></div>
6064 <div class="popover-item sort-ascending" (click)="this.onSortChange(SORT_ASC)">
6165 Sort Ascending
6266 <ht-icon class="popover-item-icon" icon="${ IconType . ArrowUp } " size="${ IconSize . Small } "></ht-icon>
@@ -65,19 +69,15 @@ import { TableColumnConfigExtended } from '../table.service';
6569 Sort Descending
6670 <ht-icon class="popover-item-icon" icon="${ IconType . ArrowDown } " size="${ IconSize . Small } "></ht-icon>
6771 </div>
68- <div class="popover-item-divider" *ngIf="this.editable"></div>
6972 </ng-container>
7073
71- <ng-container *ngIf="this.editable">
74+ <ng-container *ngIf="this.editable && this.isEditableAvailableColumns">
75+ <div class="popover-item-divider"></div>
7276 <div class="popover-item" (click)="this.onEditColumns()">Edit Columns</div>
7377 </ng-container>
7478 </div>
7579 </ht-popover-content>
7680 </ht-popover>
77-
78- <ng-template #htmlTooltip>
79- <div [innerHTML]="this.columnConfig?.titleTooltip"></div>
80- </ng-template>
8181 </ng-template>
8282 </div>
8383 `
@@ -115,6 +115,8 @@ export class TableHeaderCellRendererComponent implements OnInit, OnChanges {
115115 public classes : string [ ] = [ ] ;
116116
117117 public isFilterable : boolean = false ;
118+ public isEditableAvailableColumns : boolean = false ;
119+ public isShowOptionButton : boolean = false ;
118120
119121 @ViewChild ( 'htmlTooltip' )
120122 public htmlTooltipTemplate ?: TemplateRef < unknown > ;
@@ -132,6 +134,9 @@ export class TableHeaderCellRendererComponent implements OnInit, OnChanges {
132134
133135 if ( changes . columnConfig || changes . metadata ) {
134136 this . isFilterable = this . isAttributeFilterable ( ) ;
137+ this . isEditableAvailableColumns = this . areAnyAvailableColumnsEditable ( ) ;
138+ this . isShowOptionButton =
139+ this . isFilterable || this . isEditableAvailableColumns || this . columnConfig ?. sortable === true ;
135140 }
136141 }
137142
@@ -183,6 +188,18 @@ export class TableHeaderCellRendererComponent implements OnInit, OnChanges {
183188 ) ;
184189 }
185190
191+ private areAnyAvailableColumnsEditable ( ) : boolean {
192+ if ( this . availableColumns === undefined ) {
193+ return false ;
194+ }
195+
196+ return this . availableColumns . some ( column => this . isColumnEditable ( column ) ) ;
197+ }
198+
199+ private isColumnEditable ( columnConfig : TableColumnConfigExtended ) : boolean {
200+ return columnConfig . editable === true ;
201+ }
202+
186203 public onFilterValues ( ) : void {
187204 this . isFilterable &&
188205 this . modalService . createModal < InFilterModalData > ( {
0 commit comments