Skip to content

Commit db79d9c

Browse files
authored
DataGrid - Console displays an error when Tab navigation is used after changing the cell value (T1210910) (#27350)
1 parent 1d12885 commit db79d9c

File tree

60 files changed

+76
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+76
-13
lines changed

.github/actions/pin-browsers/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Install and setup Chrome and Firefox"
44
inputs:
55
chrome-version:
66
description: "Chrome version to install"
7-
default: "112.0.5615.165-1"
7+
default: "121.0.6167.160-1"
88
firefox-version:
99
description: "Firefox version to install"
1010
default: "latest"

.github/workflows/devextreme_npm_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,13 @@ jobs:
220220
REMOTE_BRANCH=${{github.event.pull_request.head.ref}}
221221
222222
if [ "$(git ls-remote --heads $REMOTE_URL $REMOTE_BRANCH | wc -l)" == "1" ]; then
223-
git clone -b $REMOTE_BRANCH $REMOTE_URL ./devextreme-demos
223+
git clone -b $REMOTE_BRANCH --depth 1 $REMOTE_URL ./devextreme-demos
224224
fi
225225
226226
- name: Clone devextreme-demos repo
227227
run: |
228228
BASE_BRANCH=$(node -p -e "require('./package.json').version.slice(0, 4).replace('.', '_')")
229-
test -d ./devextreme-demos || git clone -b $BASE_BRANCH https://github.com/devexpress/devextreme-demos ./devextreme-demos
229+
test -d ./devextreme-demos || git clone -b $BASE_BRANCH --depth 1 https://github.com/devexpress/devextreme-demos ./devextreme-demos
230230
231231
- name: Download artifacts
232232
uses: actions/download-artifact@v3

js/__internal/grids/grid_core/validating/m_validating.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,12 @@ export const validatingModule = {
13621362
const value = validator.option('adapter').getValue();
13631363
if (cellValueShouldBeValidated(value, rowOptions) || validatingController._rowIsValidated(change)) {
13641364
editingController.waitForDeferredOperations().done(() => {
1365+
// NOTE: after waiting for deferred operations another rerender may occur.
1366+
// In this case this validating is outdated
1367+
const isDetached = !this._rowsView.isElementInside($element);
1368+
if (isDetached) {
1369+
return;
1370+
}
13651371
when(validatingController.validateCell(validator)).done((result) => {
13661372
validationResult = result;
13671373
const { column } = validationResult.validator.option('dataGetter')();

js/__internal/grids/grid_core/views/m_rows_view.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,12 @@ export class RowsView extends ColumnsView {
12521252
setScrollerSpacing() { }
12531253

12541254
_restoreErrorRow() { }
1255+
1256+
public isElementInside($element) {
1257+
const $rowsViewElement = $element.closest(`.${this.addWidgetPrefix(ROWS_VIEW_CLASS)}`);
1258+
1259+
return $rowsViewElement.is(this.element());
1260+
}
12551261
}
12561262

12571263
export const rowsModule = {

testing/testcafe/tests/dataGrid/focus/focusedRow/focusedRow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ test('Scrolling should not occured after deleting via push API if scrolling.mode
757757
});
758758
});
759759

760-
test('Scroll should not change focused row if focus method is called inside onContentReady (T1047794)', async (t) => {
760+
test.skip('Scroll should not change focused row if focus method is called inside onContentReady (T1047794)', async (t) => {
761761
const dataGrid = new DataGrid('#container');
762762

763763
await t
116 Bytes
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import url from '../../../helpers/getPageUrl';
2+
import createWidget from '../../../helpers/createWidget';
3+
import DataGrid from '../../../model/dataGrid';
4+
5+
fixture.disablePageReloads`Validation`
6+
.page(url(__dirname, '../../container.html'));
7+
8+
[true, false].forEach((repaintChangesOnly) => {
9+
test(`Navigation with tab without saving should not throw an error (repaintChangesOnly: ${repaintChangesOnly})`, async (t) => {
10+
const grid = new DataGrid('#container');
11+
12+
await t.click(grid.getDataCell(0, 0).element);
13+
14+
const editor = grid.getDataCell(0, 0).getEditor();
15+
16+
await t.typeText(editor.element, '123');
17+
await t.pressKey('tab');
18+
19+
await t.expect(true).ok('no errors');
20+
}).before(() => createWidget('dxDataGrid', {
21+
dataSource: [{
22+
id: 1,
23+
col2: 30,
24+
col3: 240,
25+
},
26+
{
27+
id: 2,
28+
col2: 15,
29+
col3: 120,
30+
}],
31+
keyExpr: 'id',
32+
repaintChangesOnly,
33+
columnAutoWidth: true,
34+
showBorders: true,
35+
paging: {
36+
enabled: false,
37+
},
38+
editing: {
39+
mode: 'cell',
40+
allowUpdating: true,
41+
allowAdding: true,
42+
},
43+
columns: [{
44+
dataField: 'col2',
45+
validationRules: [{ type: 'required' }],
46+
}, {
47+
dataField: 'col3',
48+
validationRules: [{ type: 'required' }],
49+
}],
50+
}));
51+
});
212 Bytes
1.56 KB
1.98 KB

0 commit comments

Comments
 (0)