PROD-5684: Setting to disable sorting in Entity-group tables and Table-widgets
This commit is contained in:
parent
5f41a359c0
commit
343df41a26
@ -78,7 +78,7 @@
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
<ng-container [matColumnDef]="column.def" *ngFor="let column of columns; let $index = index; trackBy: trackByColumnDef;">
|
||||
<mat-header-cell [style]="headerStyle(column)" *matHeaderCellDef mat-sort-header [disabled]="isSorting(column)">
|
||||
<mat-header-cell [style]="headerStyle(column)" *matHeaderCellDef mat-sort-header [disabled]="!column.sortable">
|
||||
{{ column.title }}
|
||||
</mat-header-cell>
|
||||
<mat-cell *matCellDef="let alarm; let row = index"
|
||||
|
||||
@ -429,6 +429,7 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
|
||||
dataKey.label = this.utils.customTranslation(dataKey.label, dataKey.label);
|
||||
dataKey.title = getHeaderTitle(dataKey, keySettings, this.utils);
|
||||
dataKey.def = 'def' + this.columns.length;
|
||||
dataKey.sortable = !keySettings.disableSorting && !(dataKey.type === DataKeyType.alarm && dataKey.name.startsWith('details.'));
|
||||
if (dataKey.type === DataKeyType.alarm && !isDefined(keySettings.columnWidth)) {
|
||||
const alarmField = alarmFields[dataKey.name];
|
||||
if (alarmField && alarmField.time) {
|
||||
@ -1146,10 +1147,6 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit,
|
||||
}
|
||||
}
|
||||
|
||||
isSorting(column: EntityColumn): boolean {
|
||||
return column.type === DataKeyType.alarm && column.name.startsWith('details.');
|
||||
}
|
||||
|
||||
private clearCache() {
|
||||
this.cellContentCache.length = 0;
|
||||
this.cellStyleCache.length = 0;
|
||||
|
||||
@ -448,7 +448,8 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni
|
||||
dataKey.label = this.utils.customTranslation(dataKey.label, dataKey.label);
|
||||
dataKey.title = getHeaderTitle(dataKey, keySettings, this.utils);
|
||||
dataKey.def = 'def' + this.columns.length;
|
||||
dataKey.sortable = !dataKey.usePostProcessing && (!dataKey.aggregationType || dataKey.aggregationType === AggregationType.NONE);
|
||||
dataKey.sortable = !keySettings.disableSorting && !dataKey.usePostProcessing
|
||||
&& (!dataKey.aggregationType ||dataKey.aggregationType === AggregationType.NONE);
|
||||
if (dataKey.type === DataKeyType.entityField &&
|
||||
!isDefined(keySettings.columnWidth) || keySettings.columnWidth === '0px') {
|
||||
const entityField = entityFields[dataKey.name];
|
||||
|
||||
@ -59,6 +59,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="tb-form-row">
|
||||
<mat-slide-toggle class="mat-slide" formControlName="disableSorting">
|
||||
{{ 'widgets.table.disable-sorting' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tb-form-panel tb-slide-toggle">
|
||||
<mat-expansion-panel class="tb-settings" [expanded]="alarmsTableKeySettingsForm.get('useCellStyleFunction').value">
|
||||
|
||||
@ -47,7 +47,8 @@ export class AlarmsTableKeySettingsComponent extends WidgetSettingsComponent {
|
||||
useCellContentFunction: false,
|
||||
cellContentFunction: '',
|
||||
defaultColumnVisibility: 'visible',
|
||||
columnSelectionToDisplay: 'enabled'
|
||||
columnSelectionToDisplay: 'enabled',
|
||||
disableSorting: false
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,6 +62,7 @@ export class AlarmsTableKeySettingsComponent extends WidgetSettingsComponent {
|
||||
cellContentFunction: [settings.cellContentFunction, [Validators.required]],
|
||||
defaultColumnVisibility: [settings.defaultColumnVisibility, []],
|
||||
columnSelectionToDisplay: [settings.columnSelectionToDisplay, []],
|
||||
disableSorting: [settings.disableSorting, []]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="tb-form-row">
|
||||
<mat-slide-toggle class="mat-slide" formControlName="disableSorting">
|
||||
{{ 'widgets.table.disable-sorting' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tb-form-panel tb-slide-toggle">
|
||||
<mat-expansion-panel class="tb-settings" [expanded]="timeseriesTableKeySettingsForm.get('useCellStyleFunction').value">
|
||||
|
||||
@ -45,7 +45,8 @@ export class TimeseriesTableKeySettingsComponent extends WidgetSettingsComponent
|
||||
useCellContentFunction: false,
|
||||
cellContentFunction: '',
|
||||
defaultColumnVisibility: 'visible',
|
||||
columnSelectionToDisplay: 'enabled'
|
||||
columnSelectionToDisplay: 'enabled',
|
||||
disableSorting: false
|
||||
};
|
||||
}
|
||||
|
||||
@ -57,6 +58,7 @@ export class TimeseriesTableKeySettingsComponent extends WidgetSettingsComponent
|
||||
cellContentFunction: [settings.cellContentFunction, [Validators.required]],
|
||||
defaultColumnVisibility: [settings.defaultColumnVisibility, []],
|
||||
columnSelectionToDisplay: [settings.columnSelectionToDisplay, []],
|
||||
disableSorting: [settings.disableSorting, []]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="tb-form-row">
|
||||
<mat-slide-toggle class="mat-slide" formControlName="disableSorting">
|
||||
{{ 'widgets.table.disable-sorting' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
<div [class.!hidden]="!timeseriesTableLatestKeySettingsForm.get('show').value" class="tb-form-panel tb-slide-toggle">
|
||||
<mat-expansion-panel class="tb-settings" [expanded]="timeseriesTableLatestKeySettingsForm.get('useCellStyleFunction').value">
|
||||
|
||||
@ -46,7 +46,8 @@ export class TimeseriesTableLatestKeySettingsComponent extends WidgetSettingsCom
|
||||
useCellContentFunction: false,
|
||||
cellContentFunction: '',
|
||||
defaultColumnVisibility: 'visible',
|
||||
columnSelectionToDisplay: 'enabled'
|
||||
columnSelectionToDisplay: 'enabled',
|
||||
disableSorting: false
|
||||
};
|
||||
}
|
||||
|
||||
@ -60,6 +61,7 @@ export class TimeseriesTableLatestKeySettingsComponent extends WidgetSettingsCom
|
||||
cellContentFunction: [settings.cellContentFunction, [Validators.required]],
|
||||
defaultColumnVisibility: [settings.defaultColumnVisibility, []],
|
||||
columnSelectionToDisplay: [settings.columnSelectionToDisplay, []],
|
||||
disableSorting: [settings.disableSorting, []]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="tb-form-row">
|
||||
<mat-slide-toggle class="mat-slide" formControlName="disableSorting">
|
||||
{{ 'widgets.table.disable-sorting' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tb-form-panel tb-slide-toggle">
|
||||
<mat-expansion-panel class="tb-settings" [expanded]="entitiesTableKeySettingsForm.get('useCellStyleFunction').value">
|
||||
|
||||
@ -47,7 +47,8 @@ export class EntitiesTableKeySettingsComponent extends WidgetSettingsComponent {
|
||||
useCellContentFunction: false,
|
||||
cellContentFunction: '',
|
||||
defaultColumnVisibility: 'visible',
|
||||
columnSelectionToDisplay: 'enabled'
|
||||
columnSelectionToDisplay: 'enabled',
|
||||
disableSorting: false
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,6 +62,7 @@ export class EntitiesTableKeySettingsComponent extends WidgetSettingsComponent {
|
||||
cellContentFunction: [settings.cellContentFunction, [Validators.required]],
|
||||
defaultColumnVisibility: [settings.defaultColumnVisibility, []],
|
||||
columnSelectionToDisplay: [settings.columnSelectionToDisplay, []],
|
||||
disableSorting: [settings.disableSorting, []]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,7 @@ export interface TableWidgetDataKeySettings {
|
||||
cellContentFunction?: TbFunction;
|
||||
defaultColumnVisibility?: ColumnVisibilityOptions;
|
||||
columnSelectionToDisplay?: ColumnSelectionOptions;
|
||||
disableSorting?: boolean;
|
||||
}
|
||||
|
||||
export type ShowCellButtonActionFunction = (ctx: WidgetContext, data: EntityData | AlarmDataInfo | FormattedData) => boolean;
|
||||
@ -145,7 +146,7 @@ export function entityDataSortOrderFromString(strSortOrder: string, columns: Ent
|
||||
if (!column) {
|
||||
column = findColumnByName(property, columns);
|
||||
}
|
||||
if (column && column.entityKey) {
|
||||
if (column && column.entityKey && column.sortable) {
|
||||
return {key: column.entityKey, direction};
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -518,8 +518,8 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
||||
const latestDataKeys = datasource.latestDataKeys;
|
||||
let header: TimeseriesHeader[] = [];
|
||||
dataKeys.forEach((dataKey, index) => {
|
||||
const sortable = !dataKey.usePostProcessing;
|
||||
const keySettings: TableWidgetDataKeySettings = dataKey.settings;
|
||||
const sortable = !keySettings.disableSorting && !dataKey.usePostProcessing;
|
||||
const styleInfo = getCellStyleInfo(this.ctx, keySettings, 'value, rowData, ctx');
|
||||
const contentFunctionInfo = getCellContentFunctionInfo(this.ctx, keySettings, 'value, rowData, ctx');
|
||||
const columnDefaultVisibility = getColumnDefaultVisibility(keySettings, this.ctx);
|
||||
@ -544,8 +544,8 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI
|
||||
if (latestDataKeys) {
|
||||
latestDataKeys.forEach((dataKey, latestIndex) => {
|
||||
const index = dataKeys.length + latestIndex;
|
||||
const sortable = !dataKey.usePostProcessing;
|
||||
const keySettings: TimeseriesWidgetLatestDataKeySettings = dataKey.settings;
|
||||
const sortable = !keySettings.disableSorting && !dataKey.usePostProcessing;
|
||||
const styleInfo = getCellStyleInfo(this.ctx, keySettings, 'value, rowData, ctx');
|
||||
const contentFunctionInfo = getCellContentFunctionInfo(this.ctx, keySettings, 'value, rowData, ctx');
|
||||
const columnDefaultVisibility = getColumnDefaultVisibility(keySettings, this.ctx);
|
||||
|
||||
@ -8164,7 +8164,8 @@
|
||||
"timeseries-column-error": "At least one time series column should be specified",
|
||||
"alarm-column-error": "At least one alarm column should be specified",
|
||||
"table-tabs": "Table tabs",
|
||||
"show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode"
|
||||
"show-cell-actions-menu-mobile": "Show cell actions dropdown menu in mobile mode",
|
||||
"disable-sorting": "Disable sorting"
|
||||
},
|
||||
"latest-chart": {
|
||||
"total": "Total",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user