Browse Source

feat: scroll to the last column after creating a new column

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5805/head
Pranav C 1 year ago
parent
commit
42409a0a7d
  1. 14
      packages/nc-gui/components/smartsheet/Grid.vue

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

@ -776,9 +776,17 @@ eventBus.on(async (event, payload) => {
}
})
const closeAddColumnDropdown = () => {
const closeAddColumnDropdown = (scrollToLastAddNewRowHeader = false) => {
columnOrder.value = null
addColumnDropdown.value = false
if (scrollToLastAddNewRowHeader) {
setTimeout(() => {
const lastAddNewRowHeader = tableHead.value?.querySelector('th:last-child')
if (lastAddNewRowHeader) {
lastAddNewRowHeader.scrollIntoView({ behavior: 'smooth' })
}
}, 200)
}
}
const confirmDeleteRow = (row: number) => {
@ -889,8 +897,8 @@ function addEmptyRow(row?: number) {
<SmartsheetColumnEditOrAddProvider
v-if="addColumnDropdown"
:column-position="columnOrder"
@submit="closeAddColumnDropdown"
@cancel="closeAddColumnDropdown"
@submit="closeAddColumnDropdown(true)"
@cancel="closeAddColumnDropdown()"
@click.stop
@keydown.stop
/>

Loading…
Cancel
Save