Browse Source

fix: while scrolling consider sticky columns width

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5786/head
Pranav C 2 years ago
parent
commit
9cfd1e328d
  1. 8
      packages/nc-gui/components/smartsheet/Grid.vue

8
packages/nc-gui/components/smartsheet/Grid.vue

@ -142,11 +142,17 @@ const getContainerScrollForElement = (
) => { ) => {
const childPos = el.getBoundingClientRect() const childPos = el.getBoundingClientRect()
const parentPos = container.getBoundingClientRect() const parentPos = container.getBoundingClientRect()
const numColWidth = container.querySelector('thead th:nth-child(1)')?.getBoundingClientRect().width ?? 0
const primaryColWidth = container.querySelector('thead th:nth-child(2)')?.getBoundingClientRect().width ?? 0
const stickyColsWidth = numColWidth + primaryColWidth
const relativePos = { const relativePos = {
top: childPos.top - parentPos.top, top: childPos.top - parentPos.top,
right: childPos.right - parentPos.right, right: childPos.right - parentPos.right,
bottom: childPos.bottom - parentPos.bottom, bottom: childPos.bottom - parentPos.bottom,
left: childPos.left - parentPos.left, left: childPos.left - parentPos.left - stickyColsWidth,
} }
const scroll = { const scroll = {

Loading…
Cancel
Save