diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 30a564c4..a0f73700 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -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, diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 118047e7..455fc5fb 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -35,14 +35,16 @@
-
+
+ +
+ +
+
- - -
+
+
+
@@ -162,8 +166,11 @@ v-on:keyup.enter="doSearch" > -