Skip to content

Commit 56f77f9

Browse files
author
Alyar
committed
AI Column: Fix default value for the allowHiding option
1 parent 048cb64 commit 56f77f9

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

e2e/testcafe-devextreme/tests/dataGrid/common/aiColumn/columnChooser.functional.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ test('The AI column can be hidden when columnChooser.mode is "dragAndDrop"', asy
6666
type: 'ai',
6767
caption: 'AI Column',
6868
name: 'myAiColumn',
69-
allowHiding: true, // TODO: Remove after merging https://github.com/DevExpress/DevExtreme/pull/31104 and enabling this option by default.
7069
},
7170
{ dataField: 'id', caption: 'ID' },
7271
{ dataField: 'name', caption: 'Name' },
@@ -266,7 +265,6 @@ test('The AI column can be shown when columnChooser.mode is "dragAndDrop"', asyn
266265
caption: 'AI Column',
267266
name: 'myAiColumn',
268267
visible: false,
269-
allowHiding: true, // TODO: Remove after merging https://github.com/DevExpress/DevExtreme/pull/31104 and enabling this option by default.
270268
},
271269
{ dataField: 'id', caption: 'ID' },
272270
{ dataField: 'name', caption: 'Name' },

packages/devextreme/js/__internal/grids/grid_core/columns_controller/m_columns_controller.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import type { DataController } from '@ts/grids/grid_core/data_controller/m_data_
2525
import type { FocusController } from '@ts/grids/grid_core/focus/m_focus';
2626
import type { StateStoringController } from '@ts/grids/grid_core/state_storing/m_state_storing_core';
2727

28+
import { AI_COLUMN_NAME } from '../ai_column/const';
2829
import modules from '../m_modules';
2930
import type { Module } from '../m_types';
3031
import gridCoreUtils from '../m_utils';
@@ -141,6 +142,14 @@ export class ColumnsController extends modules.Controller {
141142

142143
public _isWarnedAboutUnsupportedProperties?: boolean;
143144

145+
private getCommonColumnSettings(column): Partial<Column> {
146+
if (!column?.type) {
147+
return this.option('commonColumnSettings');
148+
}
149+
150+
return column.type === AI_COLUMN_NAME ? { allowHiding: true } : {};
151+
}
152+
144153
public init(isApplyingUserState?): void {
145154
this._dataController = this.getController('data');
146155
this._focusController = this.getController('focus');
@@ -391,7 +400,7 @@ export class ColumnsController extends modules.Controller {
391400
}
392401

393402
public getCommonSettings(column?) {
394-
const commonColumnSettings = (!column || !column.type) && this.option('commonColumnSettings') || {};
403+
const commonColumnSettings = this.getCommonColumnSettings(column);
395404
const groupingOptions: any = this.option('grouping') ?? {};
396405
const groupPanelOptions: any = this.option('groupPanel') ?? {};
397406

0 commit comments

Comments
 (0)