Hello,
The Grid header and data cells become misaligned if the user changes the page zoom level. The right padding of the Grid header area resizes, according to the zoom level, but the scrollbar width remains the same. This triggers the misalignment.
The problem disappears after browser refresh at the current zoom level.
Everyone who is experiencing this - a possible workaround is to recalculate and reset the Grid scrollbar width after page zoom change.
Place the following code in a JavaScript file that is loaded in your app (do not add it to a .razor file):
window.addEventListener("resize", resetScrollbarWidth);
function resetScrollbarWidth() {
const scrollbarSize = getScrollBarSize();
setCssVariable("--kendo-scrollbar-width", `${scrollbarSize.width}px`);
setCssVariable("--kendo-scrollbar-height", `${scrollbarSize.height}px`);
}
function getScrollBarSize() {
const outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.overflow = 'scroll';
document.body.appendChild(outer);
const inner = document.createElement('div');
outer.appendChild(inner);
const scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
const scrollbarHeight = outer.offsetHeight - inner.offsetHeight;
outer.parentNode.removeChild(outer);
return {
width: scrollbarWidth,
height: scrollbarHeight
};
};
function setCssVariable(name, value) {
const documentElement = document.documentElement;
if (!documentElement) {
return;
}
documentElement.style.setProperty(name, value);
};