Skip to content

Conversation

@tesaide
Copy link
Contributor

@tesaide tesaide commented Dec 4, 2025

No description provided.

rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
}
if (headerRefs.value) {
// 48 - это примерная ширина чекбокса, если он есть
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

const headerRefs = useTemplateRef<HTMLElement[]>('headerRefs');
const rowHeights = ref<number[]>([]);
const columnWidths = ref<number[]>([]);
const checkboxHeaderRef = useTemplateRef<HTMLElement>('checkboxHeaderRef');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const columnWidth = 48

if (rowRefs.value) rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
if (headerRefs.value) columnWidths.value = [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch(() => props.rows, async (newRows) => {
  // rows are set to null when new records are loading
  rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
  columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
  if (!newRows) return; 

  await nextTick();

  if (rowRefs.value) {
    rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
  }
  if (headerRefs.value) {
     columnWidths.value = [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
  }
  
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants