async component loading for model editor components

This commit is contained in:
vabene1111
2024-10-08 07:44:17 +02:00
parent b857c9e4d9
commit 7d47fcf4e9
5 changed files with 20 additions and 49 deletions

View File

@@ -83,7 +83,7 @@ type VDataTableProps = InstanceType<typeof VDataTable>['$props']
const {t} = useI18n()
const router = useRouter()
const params = useUrlSearchParams('history', {initialValue: {page: "1", pageSize: "10"}})
const params = useUrlSearchParams('history', {initialValue: {page: "1"}})
const props = defineProps({
model: {
@@ -148,7 +148,6 @@ onBeforeMount(() => {
*/
// TODO proper typescript signature, this is just taken from vuetify example, must be a better solution
function loadItems({page, itemsPerPage, search, sortBy, groupBy}) {
console.log('load items called', page, params.page, itemsPerPage, params.pageSize)
loading.value = true
// TODO workaround for initial page bug see https://github.com/vuetifyjs/vuetify/issues/17966
if (page == 1 && Number(params.page) > 1 && !tablePageInitialized.value) {
@@ -156,6 +155,8 @@ function loadItems({page, itemsPerPage, search, sortBy, groupBy}) {
}
tablePageInitialized.value = true
params.page = page.toString()
useUserPreferenceStore().deviceSettings.general_tableItemsPerPage = itemsPerPage
genericModel.value.list({page: page, pageSize: itemsPerPage, query: search}).then((r: any) => {
items.value = r.results
itemCount.value = r.count