diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue
index 4cb7990b6c..ce0a77622a 100644
--- a/packages/nc-gui/components/smartsheet/grid/Table.vue
+++ b/packages/nc-gui/components/smartsheet/grid/Table.vue
@@ -885,7 +885,7 @@ const saveOrUpdateRecords = async (args: { metaValue?: TableType; viewMetaValue?
}
// #Grid Resize
-const { updateGridViewColumn, resizingColWidth, resizingCol } = useGridViewColumnOrThrow()
+const { updateGridViewColumn, gridViewCols } = useGridViewColumnOrThrow()
const onresize = (colID: string | undefined, event: any) => {
if (!colID) return
@@ -894,8 +894,7 @@ const onresize = (colID: string | undefined, event: any) => {
const onXcResizing = (cn: string | undefined, event: any) => {
if (!cn) return
- resizingCol.value = cn
- resizingColWidth.value = event.detail
+ gridViewCols.value[cn].width = `${event.detail}`
}
const loadColumn = (title: string, tp: string, colOptions?: any) => {
@@ -1231,9 +1230,13 @@ const loaderText = computed(() => {
v-xc-ver-resize
:data-col="col.id"
:data-title="col.title"
+ :style="{
+ 'min-width': gridViewCols[col.id]?.width || '200px',
+ 'max-width': gridViewCols[col.id]?.width || '200px',
+ 'width': gridViewCols[col.id]?.width || '200px',
+ }"
@xcresize="onresize(col.id, $event)"
- @xcresizing="onXcResizing(col.title, $event)"
- @xcresized="resizingCol = null"
+ @xcresizing="onXcResizing(col.id, $event)"
>
{
hasEditPermission &&
isCellSelected(rowIndex, colIndex),
}"
+ :style="{
+ 'min-width': gridViewCols[columnObj.id]?.width || '200px',
+ 'max-width': gridViewCols[columnObj.id]?.width || '200px',
+ 'width': gridViewCols[columnObj.id]?.width || '200px',
+ }"
:data-testid="`cell-${columnObj.title}-${rowIndex}`"
:data-key="`data-key-${rowIndex}-${columnObj.id}`"
:data-col="columnObj.id"
diff --git a/packages/nc-gui/composables/useGridViewColumn.ts b/packages/nc-gui/composables/useGridViewColumn.ts
index ff0899fab3..7fb30e4025 100644
--- a/packages/nc-gui/composables/useGridViewColumn.ts
+++ b/packages/nc-gui/composables/useGridViewColumn.ts
@@ -1,11 +1,9 @@
import type { ColumnType, GridColumnReqType, GridColumnType, ViewType } from 'nocodb-sdk'
import type { Ref } from 'vue'
-import { IsPublicInj, computed, inject, ref, useMetas, useNuxtApp, useRoles, useStyleTag, useUndoRedo, watch } from '#imports'
+import { IsPublicInj, computed, inject, ref, useMetas, useNuxtApp, useRoles, useUndoRedo, watch } from '#imports'
const [useProvideGridViewColumn, useGridViewColumn] = useInjectionState(
(view: Ref<(ViewType & { columns?: GridColumnType[] }) | undefined>, statePublic = false) => {
- const { css, load: loadCss, unload: unloadCss } = useStyleTag('')
-
const { isUIAllowed } = useRoles()
const { $api } = useNuxtApp()
@@ -21,24 +19,6 @@ const [useProvideGridViewColumn, useGridViewColumn] = useInjectionState(
const columns = computed(() => metas.value?.[view.value?.fk_model_id as string]?.columns || [])
- watch(
- [gridViewCols, resizingCol, resizingColWidth],
- () => {
- let style = ''
- for (const c of columns?.value || []) {
- const val = gridViewCols?.value?.[c?.id as string]?.width || '200px'
-
- if (val && c.title !== resizingCol?.value) {
- style += `[data-col="${c.id}"]{min-width:${val};max-width:${val};width: ${val};}`
- } else {
- style += `[data-col="${c.id}"]{min-width:${resizingColWidth?.value};max-width:${resizingColWidth?.value};width: ${resizingColWidth?.value};}`
- }
- }
- css.value = style
- },
- { deep: true, immediate: true },
- )
-
const loadGridViewColumns = async () => {
if (!view.value?.id && !isPublic.value) return
@@ -52,8 +32,6 @@ const [useProvideGridViewColumn, useGridViewColumn] = useInjectionState(
}),
{},
)
-
- loadCss()
}
/** when columns changes(create/delete) reload grid columns
@@ -105,7 +83,7 @@ const [useProvideGridViewColumn, useGridViewColumn] = useInjectionState(
}
}
- return { loadGridViewColumns, updateGridViewColumn, resizingCol, resizingColWidth, gridViewCols, loadCss, unloadCss }
+ return { loadGridViewColumns, updateGridViewColumn, resizingCol, resizingColWidth, gridViewCols }
},
'useGridViewColumn',
)