The method permits a user to edit the foreign key field that matches the given button. The function is asynchronous as it waits for the user to select a new entry from the foreign key table's crud page.
xxxxxxxxxx
public async edit_fk(evt:Event): Promise<void>{
The target is a HTMLButtonElement
expected to be the input clicked on.
xxxxxxxxxx
const button = <HTMLButtonElement>evt.target;
The below stops the current event from being clicked on
xxxxxxxxxx
evt.stopPropagation();
Get the crud page's administration parameters using the button
xxxxxxxxxx
const {subject, verbs, selection}: admin_parameters =
this.get_admin_parameters(button);
Using the acquired admin parameters, create a new crud page from the current page.
xxxxxxxxxx
const baby= new page(this, subject, verbs, selection);
Wait for the user to collect the crud operation results. if the user aborts the administration, the result becomes undefined.
xxxxxxxxxx
const result: crud_result | undefined = await baby.administer();
Don't forget to restore the current crud page as listeners depend on it.
xxxxxxxxxx
page.current = this;
If the user aborts, no update is required . Otherwise if the result is defined, use the result to update the current(mother) page.
xxxxxxxxxx
if (result === undefined) return;
//
this.update_fk(result, selection);
}