- Invia Ris a e Ricevi Ris
- Tutorial Guidato Passi da Compiere - Provincia in cui vivi - Policy aggiornata
This commit is contained in:
@@ -197,6 +197,18 @@ export default defineComponent({
|
||||
return { sortBy: 'desc', descending: false, page: 1, rowsNumber: 0, rowsPerPage: 10 }
|
||||
},
|
||||
},
|
||||
prop_SortFieldsAvailable: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: () => {
|
||||
return []
|
||||
},
|
||||
},
|
||||
margin_right: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
defaultnewrec: {
|
||||
type: Function,
|
||||
required: false,
|
||||
@@ -256,6 +268,11 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
labelElemFind: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'elementi trovati',
|
||||
}
|
||||
},
|
||||
components: {
|
||||
CMyPopupEdit, CTitleBanner, CMyFieldDb, CMySelect, CMyFriends, CMyGroups,
|
||||
@@ -346,6 +363,8 @@ export default defineComponent({
|
||||
|
||||
const myvertical = ref(props.vertical)
|
||||
|
||||
const ordinam = ref('')
|
||||
|
||||
|
||||
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
|
||||
// console.log('valoriopt', item.table)
|
||||
@@ -407,6 +426,14 @@ export default defineComponent({
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => ordinam.value, (to: any, from: any) => {
|
||||
if (pagination.value.sortBy !== ordinam.value) {
|
||||
tools.setCookie('s_ordinam_' + props.prop_mytable, ordinam.value)
|
||||
pagination.value.sortBy = ordinam.value
|
||||
refresh()
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => showfilter.value, (newval: any, from: any) => {
|
||||
tools.setCookie('s_adv', newval ? '1' : '0')
|
||||
})
|
||||
@@ -581,17 +608,30 @@ export default defineComponent({
|
||||
return returnedCount
|
||||
}
|
||||
|
||||
function getOrderByField(field: string, precorder: number): number {
|
||||
if ((field === 'date_reg') || (field === 'numMembers')) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return precorder ? precorder : 1;
|
||||
}
|
||||
|
||||
// emulate ajax call
|
||||
// SELECT * FROM ... WHERE...LIMIT...
|
||||
async function fetchFromServer(startRow: any, endRow: any, param_myfilter: any, param_myfilterand: any, sortBy: any, descending: any) {
|
||||
// console.log('fetchFromServer')
|
||||
let myobj: any = {}
|
||||
if (sortBy) {
|
||||
myobj = {}
|
||||
if (descending) {
|
||||
myobj[sortBy] = -1
|
||||
let arrsort = sortBy.split(',');
|
||||
let arrdescending = (descending && descending.length > 0) ? descending.split(',') : [];
|
||||
if (arrsort) {
|
||||
for (let i = 0; i < arrsort.length; i++) {
|
||||
let field = arrsort[i].trim()
|
||||
myobj[field] = (tools.isArray(arrdescending) && (arrdescending.length > [i])) ? parseInt(arrdescending[i].trim()) : 1;
|
||||
myobj[field] = getOrderByField(field, myobj[field])
|
||||
}
|
||||
} else {
|
||||
myobj[sortBy] = 1
|
||||
myobj[sortBy] = getOrderByField(sortBy, descending ? -1 : 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,7 +892,6 @@ export default defineComponent({
|
||||
// @ts-ignore
|
||||
filter_gte,
|
||||
sortBy: myobj,
|
||||
descending,
|
||||
userId: userStore.my._id,
|
||||
codeId: '',
|
||||
options: props.options,
|
||||
@@ -944,6 +983,7 @@ export default defineComponent({
|
||||
pagination.value.page = page
|
||||
pagination.value.rowsPerPage = rowsPerPage
|
||||
pagination.value.sortBy = sortBy
|
||||
ordinam.value = sortBy
|
||||
pagination.value.descending = descending
|
||||
|
||||
console.log('pagination', pagination)
|
||||
@@ -957,10 +997,13 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function onUpdateData(index: number, myprops: any, done: any) {
|
||||
const { page, rowsPerPage, rowsNumber, sortBy, descending } = myprops.pagination
|
||||
let { page, rowsPerPage, rowsNumber, sortBy, descending } = myprops.pagination
|
||||
const myfilternow = myfilter.value
|
||||
const myfilterandnow = myfilterand.value
|
||||
|
||||
if (ordinam.value)
|
||||
sortBy = ordinam.value
|
||||
|
||||
savefilter()
|
||||
|
||||
if (!mytable.value) {
|
||||
@@ -1012,6 +1055,7 @@ export default defineComponent({
|
||||
pagination.value.page = page
|
||||
pagination.value.rowsPerPage = rowsPerPage
|
||||
pagination.value.sortBy = sortBy
|
||||
ordinam.value = sortBy
|
||||
pagination.value.descending = descending
|
||||
|
||||
// console.log('pagination', pagination)
|
||||
@@ -1392,6 +1436,7 @@ export default defineComponent({
|
||||
tablesel.value = tools.getCookie('tablesel', tablesel.value)
|
||||
}
|
||||
|
||||
|
||||
myfilterand.value = props.filterdef
|
||||
// myfiltercustom.value = props.filtercustom
|
||||
// console.log('tablesel', tablesel)
|
||||
@@ -1403,6 +1448,8 @@ export default defineComponent({
|
||||
tablesel.value = mytable.value
|
||||
}
|
||||
|
||||
ordinam.value = tools.getCookie('s_ordinam_' + tablesel.value, null)
|
||||
|
||||
// console.log('2) tablesel', tablesel.value)
|
||||
|
||||
changeTable(tablesel.value)
|
||||
@@ -1662,6 +1709,10 @@ export default defineComponent({
|
||||
// console.log('REFRR - doSearch')
|
||||
refresh()
|
||||
}
|
||||
function doSort() {
|
||||
|
||||
refresh()
|
||||
}
|
||||
|
||||
function changefuncAct(newval: any) {
|
||||
if (!disabilita()) {
|
||||
@@ -2186,6 +2237,8 @@ export default defineComponent({
|
||||
newRecordBoolOld,
|
||||
showSpin,
|
||||
userStore,
|
||||
doSort,
|
||||
ordinam,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user