-
Notifications
You must be signed in to change notification settings - Fork 671
DataGrid: Fix header borders being cut off above the vertical scrollbar (T1306973) #34372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0e7ba06
d3c746d
5674499
b9126d5
5e50bbc
f6c358f
f3e1838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { | ||
| afterEach, beforeEach, describe, expect, it, | ||
| } from '@jest/globals'; | ||
|
|
||
| import { | ||
| afterTest, beforeTest, createDataGrid, | ||
| } from '../../__tests__/__mock__/helpers/utils'; | ||
|
|
||
| const SCROLLER_SPACING_CLASS = 'dx-datagrid-scroller-spacing'; | ||
|
|
||
| describe('ColumnsView scroller spacing (T1306973)', () => { | ||
| beforeEach(() => { | ||
| beforeTest(); | ||
| }); | ||
|
|
||
| afterEach(() => { | ||
| afterTest(); | ||
| }); | ||
|
|
||
| it('should toggle the scroller spacing class on the headers view', async () => { | ||
| const { instance } = await createDataGrid({ | ||
| dataSource: [{ id: 1, a: 'a', b: 'b' }], | ||
| columns: ['a', 'b'], | ||
| }); | ||
| const columnHeadersView = instance.getView('columnHeadersView'); | ||
|
|
||
| columnHeadersView.setScrollerSpacing(15); | ||
|
|
||
| expect(columnHeadersView.element().hasClass(SCROLLER_SPACING_CLASS)).toBe(true); | ||
| expect(columnHeadersView.element().css('paddingRight')).toBe('15px'); | ||
|
|
||
|
Alyar666 marked this conversation as resolved.
|
||
| columnHeadersView.setScrollerSpacing(0); | ||
|
|
||
| expect(columnHeadersView.element().hasClass(SCROLLER_SPACING_CLASS)).toBe(false); | ||
| }); | ||
|
|
||
| it('should toggle the scroller spacing class on the footer view', async () => { | ||
| const { instance } = await createDataGrid({ | ||
| dataSource: [{ id: 1, a: 'a', b: 'b' }], | ||
| columns: ['a', 'b'], | ||
| summary: { | ||
| totalItems: [{ column: 'a', summaryType: 'count' }], | ||
| }, | ||
| }); | ||
| const footerView = instance.getView('footerView'); | ||
|
|
||
| footerView.setScrollerSpacing(15); | ||
|
|
||
| expect(footerView.element().hasClass(SCROLLER_SPACING_CLASS)).toBe(true); | ||
|
|
||
| footerView.setScrollerSpacing(0); | ||
|
|
||
| expect(footerView.element().hasClass(SCROLLER_SPACING_CLASS)).toBe(false); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export const CLASSES = { | ||
| firstCell: 'first-cell', | ||
| scrollerSpacing: 'scroller-spacing', | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1486,15 +1486,16 @@ export class ColumnsView extends ColumnStateMixin(modules.View) { | |||||||||||||||||
| /** | ||||||||||||||||||
| * @extended: column_fixing | ||||||||||||||||||
| */ | ||||||||||||||||||
| public setScrollerSpacing(width) { | ||||||||||||||||||
| const that = this; | ||||||||||||||||||
| const $element = that.element(); | ||||||||||||||||||
| const rtlEnabled = that.option('rtlEnabled'); | ||||||||||||||||||
| public setScrollerSpacing(width: number): void { | ||||||||||||||||||
| const $element = this.element(); | ||||||||||||||||||
| const rtlEnabled = this.option('rtlEnabled'); | ||||||||||||||||||
|
|
||||||||||||||||||
| $element && $element.css({ | ||||||||||||||||||
| paddingLeft: rtlEnabled ? width : '', | ||||||||||||||||||
| paddingRight: !rtlEnabled ? width : '', | ||||||||||||||||||
| }); | ||||||||||||||||||
| $element && $element | ||||||||||||||||||
| .toggleClass(this.addWidgetPrefix(CLASSES.scrollerSpacing), !!width) | ||||||||||||||||||
| .css({ | ||||||||||||||||||
| paddingLeft: rtlEnabled ? width : '', | ||||||||||||||||||
| paddingRight: !rtlEnabled ? width : '', | ||||||||||||||||||
| }); | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets replace it with inline start/end paddings
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This behavior was already implemented; I didn't change it. However, let's see if we can adjust it, provided the change is relatively inexpensive. |
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| protected isScrollbarVisible(isHorizontal) { | ||||||||||||||||||
|
|
||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.