I have a LWC user information form is embedded in Visual force page
Using getFieldValue
, retrieving the data and displaying in UI. When i add the below code in html file browser got hanged and display the data slowly(means taking 45 sec to display the data).
<div class="slds-section slds-is-open">
<lightning-vertical-navigation-item label={fatherName} name="fatherValue">
</lightning-vertical-navigation-item>
</div>
I removed the code and tried it's loading fast.
Also, one more help, in HTML lightning-record-edit-form record-id="a082w000000YUXxxx"
is hardcoded, how to fetch the value in JS file.
HTML
<template>
<lightning-record-edit-form record-id="a082w000000YUXxxx" object-api-name="Enrollment__c" onload={handleonLoad}>
<div class="slds-section slds-is-open">
<lightning-vertical-navigation-item label={fatherName} name="fatherValue">
</lightning-vertical-navigation-item>
</div>
</lightning-record-edit-form>
</template>
JS:
import { LightningElement, track, api, wire } from "lwc";
import { getRecord, getFieldValue } from "lightning/uiRecordApi";
import FATHER_NAME from "@salesforce/schema/Enrollment__c.Father_First_Name__c";
const fields = [FATHER_NAME];
export default class Enrollment_2 extends LightningElement {
@track enrollmentId;
@track fatherName;
@api recordId;
@track familyName = [
{ fieldAPI: "Enrollment_Type__c", required: true },
{ fieldAPI: "Family_Name__c", required: true },
{ fieldAPI: "Home_Phone__c", required: true }
];
@wire(getRecord, { recordId: "a082w000000YUXxxx", fields })
Enrollment;
handleonLoad() {
this.fatherName = getFieldValue(this.Enrollment.data, FATHER_NAME);
this.fatherName = "Father - " + this.fatherName;
}
}