fix: trigger onload method if controller is loaded
This commit is contained in:
parent
bb6a90058b
commit
8db846ad5d
@ -75,6 +75,8 @@ export function useDocument(doctype, docname) {
|
|||||||
organizedControllers[controllerKey].push(controller)
|
organizedControllers[controllerKey].push(controller)
|
||||||
}
|
}
|
||||||
controllersCache[doctype][docname || ''] = organizedControllers
|
controllersCache[doctype][docname || ''] = organizedControllers
|
||||||
|
|
||||||
|
triggerOnload()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getControllers(row = null) {
|
function getControllers(row = null) {
|
||||||
@ -93,9 +95,16 @@ export function useDocument(doctype, docname) {
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function triggerOnload() {
|
||||||
|
const handler = async function () {
|
||||||
|
await this.onload?.()
|
||||||
|
}
|
||||||
|
await trigger(handler)
|
||||||
|
}
|
||||||
|
|
||||||
async function triggerOnRefresh() {
|
async function triggerOnRefresh() {
|
||||||
const handler = async function () {
|
const handler = async function () {
|
||||||
await this.refresh()
|
await this.refresh?.()
|
||||||
}
|
}
|
||||||
await trigger(handler)
|
await trigger(handler)
|
||||||
}
|
}
|
||||||
@ -189,6 +198,8 @@ export function useDocument(doctype, docname) {
|
|||||||
return {
|
return {
|
||||||
document: documentsCache[doctype][docname || ''],
|
document: documentsCache[doctype][docname || ''],
|
||||||
assignees,
|
assignees,
|
||||||
|
getControllers,
|
||||||
|
triggerOnload,
|
||||||
triggerOnChange,
|
triggerOnChange,
|
||||||
triggerOnRowAdd,
|
triggerOnRowAdd,
|
||||||
triggerOnRowRemove,
|
triggerOnRowRemove,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user