fix: when resize is triggered by ListHeader then apply changes
This commit is contained in:
parent
0ba169c161
commit
2e62ee167f
@ -10,7 +10,7 @@
|
|||||||
}"
|
}"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
>
|
>
|
||||||
<ListHeader class="mx-5" />
|
<ListHeader class="mx-5" @columnWidthUpdated="emit('columnWidthUpdated')" />
|
||||||
<ListRows id="list-rows">
|
<ListRows id="list-rows">
|
||||||
<ListRow
|
<ListRow
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
@ -164,7 +164,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['loadMore', 'updatePageCount'])
|
const emit = defineEmits(['loadMore', 'updatePageCount', 'columnWidthUpdated'])
|
||||||
|
|
||||||
const pageLengthCount = defineModel()
|
const pageLengthCount = defineModel()
|
||||||
const list = defineModel('list')
|
const list = defineModel('list')
|
||||||
|
|||||||
@ -113,6 +113,7 @@ const { isManager } = usersStore()
|
|||||||
|
|
||||||
const list = defineModel()
|
const list = defineModel()
|
||||||
const loadMore = defineModel('loadMore')
|
const loadMore = defineModel('loadMore')
|
||||||
|
const resizeColumn = defineModel('resizeColumn')
|
||||||
const updatedPageCount = defineModel('updatedPageCount')
|
const updatedPageCount = defineModel('updatedPageCount')
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@ -151,6 +152,11 @@ watch(loadMore, (value) => {
|
|||||||
updatePageLength(value, true)
|
updatePageLength(value, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(resizeColumn, (value) => {
|
||||||
|
if (!value) return
|
||||||
|
updateColumns()
|
||||||
|
})
|
||||||
|
|
||||||
watch(updatedPageCount, (value) => {
|
watch(updatedPageCount, (value) => {
|
||||||
if (!value) return
|
if (!value) return
|
||||||
updatePageLength(value)
|
updatePageLength(value)
|
||||||
@ -330,6 +336,14 @@ function updateSort(order_by) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateColumns(obj) {
|
function updateColumns(obj) {
|
||||||
|
if (!obj) {
|
||||||
|
obj = {
|
||||||
|
columns: list.value.data.columns,
|
||||||
|
rows: list.value.data.rows,
|
||||||
|
isDefault: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!defaultParams.value) {
|
if (!defaultParams.value) {
|
||||||
defaultParams.value = getParams()
|
defaultParams.value = getParams()
|
||||||
}
|
}
|
||||||
@ -363,7 +377,10 @@ function create_or_update_default_view() {
|
|||||||
{
|
{
|
||||||
view: view.value,
|
view: view.value,
|
||||||
}
|
}
|
||||||
).then(() => reloadView())
|
).then(() => {
|
||||||
|
reloadView()
|
||||||
|
viewUpdated.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePageLength(value, loadMore = false) {
|
function updatePageLength(value, loadMore = false) {
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
<ViewControls
|
<ViewControls
|
||||||
v-model="deals"
|
v-model="deals"
|
||||||
v-model:loadMore="loadMore"
|
v-model:loadMore="loadMore"
|
||||||
|
v-model:resizeColumn="triggerResize"
|
||||||
v-model:updatedPageCount="updatedPageCount"
|
v-model:updatedPageCount="updatedPageCount"
|
||||||
doctype="CRM Deal"
|
doctype="CRM Deal"
|
||||||
/>
|
/>
|
||||||
@ -27,6 +28,7 @@
|
|||||||
totalCount: deals.data.total_count,
|
totalCount: deals.data.total_count,
|
||||||
}"
|
}"
|
||||||
@loadMore="() => loadMore++"
|
@loadMore="() => loadMore++"
|
||||||
|
@columnWidthUpdated="() => triggerResize++"
|
||||||
@updatePageCount="(count) => (updatedPageCount = count)"
|
@updatePageCount="(count) => (updatedPageCount = count)"
|
||||||
/>
|
/>
|
||||||
<div v-else-if="deals.data" class="flex h-full items-center justify-center">
|
<div v-else-if="deals.data" class="flex h-full items-center justify-center">
|
||||||
@ -90,6 +92,7 @@ const router = useRouter()
|
|||||||
// deals data is loaded in the ViewControls component
|
// deals data is loaded in the ViewControls component
|
||||||
const deals = ref({})
|
const deals = ref({})
|
||||||
const loadMore = ref(1)
|
const loadMore = ref(1)
|
||||||
|
const triggerResize = ref(1)
|
||||||
const updatedPageCount = ref(20)
|
const updatedPageCount = ref(20)
|
||||||
|
|
||||||
// Rows
|
// Rows
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user