Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri committed Sep 12, 2023
1 parent 9ac8579 commit 6078ef5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getOuterHeight } from '@js/core/utils/size';
import { isDefined } from '@js/core/utils/type';
import { getWindow } from '@js/core/utils/window';
import LoadIndicator from '@js/ui/load_indicator';
import errors from '@js/ui/widget/ui.errors';

import gridCoreUtils from '../m_utils';
import { subscribeToExternalScrollers, VirtualScrollController } from './m_virtual_scrolling_core';
Expand Down Expand Up @@ -484,6 +485,8 @@ const VirtualScrollingRowsViewExtender = (function () {
const changeType = change && change.changeType;
const d: any = Deferred();

this.throwHeightWarningIfNeed();

const contentTable = contentElement.children().first();
if (changeType === 'append' || changeType === 'prepend') {
this.waitAsyncTemplates().done(() => {
Expand Down Expand Up @@ -746,6 +749,14 @@ const VirtualScrollingRowsViewExtender = (function () {
this.callBase.call(this, isLoading, messageText);
},

throwHeightWarningIfNeed() {
const needToThrow = !this._hasHeight && isVirtualPaging(this);
if (needToThrow && !this._heightWarningIsThrown) {
this._heightWarningIsThrown = true;
errors.log('W1025');
}
},

_resizeCore() {
const that = this;
const $element = that.element();
Expand Down
5 changes: 5 additions & 0 deletions packages/devextreme/js/ui/widget/ui.errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,9 @@ export default errorUtils(errors.ERROR_MESSAGES, {
* @name ErrorsUIWidgets.W1024
*/
W1024: 'The client-side export is enabled. Implement the \'onExporting\' function.',

/**
* @name ErrorsUIWidgets.W1025
*/
W1025: '\'scrolling.mode\' is set to \'virtual\' or \'infinite\'. Specify height for the component',
});
11 changes: 11 additions & 0 deletions packages/devextreme/testing/testcafe/tests/dataGrid/scrolling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1609,3 +1609,14 @@ test('Restoring focus on re-rendering should be done without unexpected scrollin
masterDetail: { enabled: true },
});
});

test('Warning should be thrown if scrolling is virtual and height is not specified', async (t) => {
const consoleMessages = await t.getBrowserConsoleMessages();
const warningExists = !!consoleMessages?.warn.find((message) => message.startsWith('W1025'));

await t.expect(warningExists).ok();
}).before(async () => createWidget('dxDataGrid', {
scrolling: {
mode: 'virtual',
},
}));

0 comments on commit 6078ef5

Please sign in to comment.