diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.html index 19a0a95abf..acd4fc43be 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm/alarms-table-widget.component.html @@ -78,7 +78,7 @@ - + {{ column.title }} +
+ + {{ 'widgets.table.disable-sorting' | translate }} + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-key-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-key-settings.component.ts index 8984e3889f..cccc826ff4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-key-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/alarm/alarms-table-key-settings.component.ts @@ -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, []] }); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.html index 1dcd4f1f3f..1905888bb6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.html @@ -47,6 +47,11 @@
+
+ + {{ 'widgets.table.disable-sorting' | translate }} + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.ts index 1bc28baf53..ff314d9d2d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-key-settings.component.ts @@ -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, []] }); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.html index 54b2a370e6..684258bea7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.html @@ -56,6 +56,11 @@
+
+ + {{ 'widgets.table.disable-sorting' | translate }} + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.ts index a0ee7e7c70..2e2f414f2c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/cards/timeseries-table-latest-key-settings.component.ts @@ -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, []] }); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.html index 76aa5fd2f4..14383b9608 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.html @@ -59,6 +59,11 @@
+
+ + {{ 'widgets.table.disable-sorting' | translate }} + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.ts index 8572a9e348..89393ade34 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/settings/entity/entities-table-key-settings.component.ts @@ -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, []] }); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts index 47ae0b8cc8..15a94f5ecc 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts @@ -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; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 0fda3b9afe..623aed9c34 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -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); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 18801bda2c..62a9b6883f 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -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",