Reviewed-on: #841 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
55f8b78eba
|
@ -134,6 +134,7 @@ const splittedColumns = ref({ columns: [] });
|
|||
const columnsVisibilitySkipped = ref();
|
||||
const createForm = ref();
|
||||
const tableFilterRef = ref([]);
|
||||
const tableRef = ref();
|
||||
|
||||
const tableModes = [
|
||||
{
|
||||
|
@ -321,6 +322,13 @@ function handleOnDataSaved(_) {
|
|||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||
else $props.create.onDataSaved(_);
|
||||
}
|
||||
|
||||
function handleScroll() {
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer
|
||||
|
@ -405,6 +413,7 @@ function handleOnDataSaved(_) {
|
|||
</template>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
ref="tableRef"
|
||||
v-bind="table"
|
||||
class="vnTable"
|
||||
:columns="splittedColumns.columns"
|
||||
|
@ -416,12 +425,7 @@ function handleOnDataSaved(_) {
|
|||
flat
|
||||
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||
:virtual-scroll="isTableMode"
|
||||
@virtual-scroll="
|
||||
(event) =>
|
||||
event.index > rows.length - 2 &&
|
||||
($props.crudModel?.paginate ?? true) &&
|
||||
CrudModelRef.vnPaginateRef.paginate()
|
||||
"
|
||||
@virtual-scroll="handleScroll"
|
||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue