InfiniteScroll

Circuits
This commit is contained in:
paoloar77
2022-08-17 00:36:30 +02:00
parent c93361dfa2
commit 8a41aff739
13 changed files with 147 additions and 74 deletions

View File

@@ -248,6 +248,7 @@ export default defineComponent({
const myrecdialog = ref(null)
const startsearch = ref(false)
const clickbuttsearch = ref(false)
const $router = useRouter()
@@ -283,7 +284,7 @@ export default defineComponent({
const colclicksel = ref(null)
const selected: any = ref([])
const showfilteradv = ref(false) // filtri avanzati
const showfilter = ref(false) // filtri avanzati
const filter = ref(0)
const filtergrp = ref(costanti.MY_GROUPS)
@@ -312,8 +313,8 @@ export default defineComponent({
}
})
watch(() => showfilteradv.value, (newval: any, from: any) => {
tools.setCookie('s_adv', newval)
watch(() => showfilter.value, (newval: any, from: any) => {
tools.setCookie('s_adv', newval ? '1' : '0')
})
watch(() => props.filtercustom, (to: any, from: any) => {
@@ -849,10 +850,10 @@ export default defineComponent({
// calculate starting row of data
const startRow = numRecLoaded.value
const endRow = startRow + fetchCount
console.log('startRow', startRow, 'endRow', endRow, 'fetchCount', fetchCount)
console.log('startRow', startRow, 'endRow', endRow, 'rowsNumber', pagination.value.rowsNumber)
if (startRow < pagination.value.rowsNumber) {
if ((startRow < pagination.value.rowsNumber) || clickbuttsearch.value) {
// fetch data from "server"
return fetchFromServer(startRow, endRow, myfilternow, myfilterandnow, sortBy, descending).then((ris: any) => {
@@ -890,7 +891,7 @@ export default defineComponent({
}
console.log(' ...DONE ')
done()
done(pagination.value.rowsNumber === 0 ? true : false)
})
} else {
startsearch.value = false
@@ -930,6 +931,7 @@ export default defineComponent({
function refresh() {
console.log('refresh', 'startsearch', startsearch.value)
clickbuttsearch.value = true
// console.log('refresh')
if (startsearch.value)
return false
@@ -963,6 +965,7 @@ export default defineComponent({
refresh_table()
}
clickbuttsearch.value = false
}
watch(() => mycodeid.value, (newval, oldval) => {
@@ -1245,7 +1248,7 @@ export default defineComponent({
myvertical.value = props.vertical
// myvertical.value = tools.getCookie('myv_' + props.prop_mytable, props.vertical)
showfilteradv.value = tools.getCookie('s_adv', false)
showfilter.value = tools.getCookie('s_adv', '0') !== '0'
}
function mounted() {
@@ -1868,11 +1871,15 @@ export default defineComponent({
function onLoadScroll (index: number, done: any) {
if (index > 0) {
console.log('onLoadScroll', index, 'RECLOAD', numRecLoaded.value, 'ROWS: ', pagination.value.rowsNumber)
if (numRecLoaded.value >= pagination.value.rowsNumber) {
done(true)
} else {
if (numRecLoaded.value < pagination.value.rowsNumber || (pagination.value.rowsNumber <= 0 && clickbuttsearch.value)) {
if (pagination.value.rowsNumber === 0) {
pagination.value.page = 0
}
pagination.value.page = pagination.value.page + 1
refresh_infscroll(done)
} else {
done(true)
}
}
}
@@ -1956,7 +1963,7 @@ export default defineComponent({
getValueExtra,
shared_consts,
getLabelFooterByRow,
showfilteradv,
showfilter,
cmdExt,
visupagedialog,
myrecdialog,