Skip to content

Commit b269209

Browse files
CardView - Header filter search is only triggered once when remoteOperations is true (T1305672) (#33953)
1 parent ce28fc4 commit b269209

14 files changed

Lines changed: 91 additions & 5 deletions

e2e/testcafe-devextreme/tests/cardView/headerFilter/remote.functional.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,3 +532,53 @@ const clearRemoteOperations = () => ClientFunction(() => {
532532
await clearRemoteOperations();
533533
});
534534
});
535+
536+
test('remote operations: true -> should load data for each search value in header filter', async (t) => {
537+
// arrange
538+
const cardView = new CardView(CARD_VIEW_SELECTOR);
539+
const filterIcon = cardView
540+
.getHeaderPanel()
541+
.getHeaderItem()
542+
.getFilterIcon();
543+
544+
// act
545+
await t.click(filterIcon);
546+
547+
// assert
548+
const list = cardView.getHeaderFilterList();
549+
await t.expect(list.getItems().count).eql(10);
550+
551+
// act
552+
await t.typeText(list.searchInput, 'A_1');
553+
554+
// assert
555+
await t.expect(list.getItems().count).eql(1);
556+
await t.expect(list.getItem(0).text).eql('A_1');
557+
558+
// act
559+
await t.typeText(list.searchInput, '1');
560+
561+
// assert
562+
await t.expect(list.getItems().count).eql(0);
563+
}).before(async (t) => {
564+
await t.addRequestHooks(remoteApiMock);
565+
await createWidget('dxCardView', () => ({
566+
dataSource: {
567+
store: (window as any).DevExpress.data.AspNet.createStore({
568+
key: 'id',
569+
loadUrl: 'https://api/data',
570+
}),
571+
},
572+
columns: ['A'],
573+
remoteOperations: true,
574+
headerFilter: {
575+
visible: true,
576+
search: {
577+
enabled: true,
578+
},
579+
},
580+
height: 600,
581+
}));
582+
}).after(async (t) => {
583+
await t.removeRequestHooks(remoteApiMock);
584+
});
124 Bytes
Loading
124 Bytes
Loading
124 Bytes
Loading
1.12 KB
Loading
120 Bytes
Loading
1.12 KB
Loading

e2e/testcafe-devextreme/tests/cardView/helpers/remoteApiMock.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ export const remoteDataGroupedByA = new Array(10)
1414
}));
1515

1616
export const remoteApiMock = RequestMock()
17+
.onRequestTo(/\/api\/data\?.*group=.*filter=.*A_11/)
18+
.respond(
19+
{
20+
data: remoteDataGroupedByA.filter((item) => item.key.includes('A_11')),
21+
},
22+
200,
23+
{ 'access-control-allow-origin': '*' },
24+
)
25+
.onRequestTo(/\/api\/data\?.*group=.*filter=.*A_1/)
26+
.respond(
27+
{
28+
data: remoteDataGroupedByA.filter((item) => item.key.includes('A_1')),
29+
},
30+
200,
31+
{ 'access-control-allow-origin': '*' },
32+
)
1733
.onRequestTo(/\/api\/data\?.*group=/)
1834
.respond(
1935
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { OptionWithChanges } from '@ts/grids/new/grid_core/options_controll
1010
import { OptionsController } from '../options_controller/options_controller';
1111
import { getTreeNodeByPath } from '../utils/tree/index';
1212
import { updateColumnSettings } from './columns_settings/index';
13-
import { IGNORE_COLUMN_OPTION_NAMES } from './const';
13+
import { COLUMNS_OBJ_COMPARE_DEPTH, IGNORE_COLUMN_OPTION_NAMES } from './const';
1414
import type { ColumnProperties, ColumnSettings, PreNormalizedColumn } from './options';
1515
import type { Column, ColumnsConfigurationFromData, VisibleColumn } from './types';
1616
import {
@@ -176,7 +176,7 @@ export class ColumnsController {
176176
newValue: unknown,
177177
prevValue: unknown,
178178
): void {
179-
if (!equalByValue(prevValue, newValue, { maxDepth: 5 })) {
179+
if (!equalByValue(prevValue, newValue, { maxDepth: COLUMNS_OBJ_COMPARE_DEPTH })) {
180180
const fullOptionPath = `columns[${columnIndex}].${optionName}`;
181181
this.options.notifyColumnOptionChanged(fullOptionPath, newValue, prevValue);
182182
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export const IGNORE_COLUMN_OPTION_NAMES = {
22
selector: true,
33
};
4+
5+
export const COLUMNS_OBJ_COMPARE_DEPTH = 5;

0 commit comments

Comments
 (0)