I was hoping to provide a custom form for the AutoQueryGrid using the editForm slot, but it doesn’t appear in the slide out and instead displays the content above the screen as per screenshot,
can you give me an example how to provide a custom form that will use the slide out or card ?
Thanks
<template>
<AutoQueryGrid
:filter="query"
selected-columns="id"
type="ServiceMaintenanceRepairEntry"
>
<template #editform="{ form, apis, type }">
<h1>kjkjsfdksfsldkfjsldkfslkfjslfksfHHIII</h1>
</template>
</AutoQueryGrid>
</template>
mythz
July 8, 2025, 9:46pm
2
Here’s an example which uses #editform
:
const Drafts = {
components: { MessageView, EmailPreview },
template:`
<AutoQueryGrid ref="grid" :type="type" hide="copyApiUrl,downloadCsv" :visibleFrom="{ rendererArgs:'never' }"
:filters="{ completedDateIsNull:'',draft:true }"
selectedColumns="id,email,layout,page,renderer,rendererArgs,createdDate">
<template #renderer="{ renderer, rendererArgs }">
<span :title="indentJson(rendererArgs)">{{renderer}}</span>
</template>
<template #editform="{ model, save, done }">
<AutoForm type="UpdateMailMessageDraft" formStyle="slideOver" :modelValue="updateModel(model)" :configureFormLayout="configureFormLayout"
submitLabel="Save" @success="save" @done="done">
<template #footer="{ model }">
<EmailPreview :renderer="model.renderer" :modelValue="model" />
</template>
<template #leftbuttons="{ instance }">
<PrimaryButton type="button" @click="submitForm(instance)" color="red">
<svg class="w-5 h-5 mr-1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="currentColor" d="M27.71 4.29a1 1 0 0 0-1.05-.23l-22 8a1 1 0 0 0 0 1.87l8.59 3.43L19.59 11L21 12.41l-6.37 6.37l3.44 8.59A1 1 0 0 0 19 28a1 1 0 0 0 .92-.66l8-22a1 1 0 0 0-.21-1.05Z"/></svg>
Send
</PrimaryButton>
The #editform
template replaces AutoQueryGrid’s built-in AutoEditForm , i.e. the SlideOver/Card isn’t apart of AutoQueryGrid, It’s included in the AutoEditForm/AutoForm components which you can control using formStyle="slideOver|card"
property, or you can use your own Form/ModalDialog.
Great thanks pointing me in the right direction, I have implemented a custom form, however the Autoquerygrid does not show the updated values and requires a manual refresh do I need to call something else besides done()?
<template>
<AutoQueryGrid
:filter="query"
type="ServiceMaintenanceRepairEntry"
>
<template #editform="{model, save, done}">
<SlideOver @cancel="handleDone(done)" @close="handleClose" @done="handleDone(done)">
<template #subtitle>
Edit
</template>
<form v-if="model" ref="form"
@submit.prevent="submitSignupDocumentsForm($event.target as HTMLFormElement,model,done)">
<ErrorSummary/>
<div class="shadow sm:overflow-hidden sm:rounded-md">
<div class="space-y-8 py-6 px-4 sm:p-6 bg-white dark:bg-black">
<input v-model="(model as ServiceMaintenanceRepairEntry).id" name="id" type="hidden"/>
<div class="border-b border-gray-200 dark:border-gray-700 pb-6">
<div class="space-y-6">
<div class="grid grid-cols-1 gap-6">
<div class="flex items-center ">
<TextInput id="description" v-model="model.description"
help="" label="Info"
placeholder=""/>
</div>
<div class="flex items-center ">
<FileInput id="attachmentUrl" v-model="(model as ServiceMaintenanceRepairEntry).description"
:status="fieldErrors" label="Upload file"/>
<FilePreview :url="(model as ServiceMaintenanceRepairEntry).attachmentUrl"/>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 dark:bg-gray-800 px-4 py-3 text-right sm:px-12">
<PrimaryButton :disabled="isLoading">Save</PrimaryButton>
</div>
</div>
</div>
</form>
</SlideOver>
</template>
</AutoQueryGrid>
</template>
async function submitSignupDocumentsForm(form: HTMLFormElement, model: UpdateServiceMaintenanceRepairEntry, done: () => void) {
// save
let formData = new FormData(form)
let request = new UpdateServiceMaintenanceRepairEntry();
let method = map(request?.['getMethod'], fn => typeof fn == 'function' ? fn() : null) || 'POST'
let returnsVoid = map(request?.['createResponse'], fn => typeof fn == 'function' ? fn() : null) == null
if (HttpMethods.hasRequestBody(method)) {
if (!returnsVoid) {
api.value = await client.apiForm(request, formData)
} else {
api.value = await client.apiFormVoid(request, formData)
}
} else {
let requestDto = new UpdateServiceMaintenanceRepairEntry(omitEmpty(model))
if (!returnsVoid) {
api.value = await client.api(requestDto)
} else {
api.value = await client.apiVoid(requestDto)
}
}
if (api.value.succeeded) {
emit('success', api.value.response)
close()
} else {
emit('error', api.value.error!)
}
done();
}
mythz
July 9, 2025, 1:54pm
4
Invoke the save
callback (i.e. instead of the done
callback) if your Edit form has made changes.
1 Like