User:HARO7095/Sample page

BASIC TOAST STRUCTURE

requires : import { ShowToastEvent } from "lightning/platformShowToastEvent";

showToastOnComplete {

this.dispatchEvent(

new ShowToastEvent({

title: this.saved,

message: "Your updates have been saved",

variant: "success"

})

);

}

 RECORD EDIT FORM









 APEX -> JS Conversions 

FOR MAP:

recordData = new Map

for (let key in result) {

this.recordData.set(key, result[key]);

}

APPEND PROPERITES TO DATA (for iteration in HTML)

let tempData2 = {

...tempData.fieldData[j],

...{

accordionList: tempData.accordionfieldData,

yesButton: false,

noButton: false}}'

 DEEP CLONE APEX OBJECT TO JS OBJECT

let newRM = {}

for (let key in this.responsemap) {

if (this.responsemap.hasOwnProperty(key)) {

newRM[key] =  [...this.responsemap[key]];;

}

}

this.responseMap2 = newRM;

 RECORD EDIT FORM 

CLEAR RECORD EDIT FORM

const inputFields = this.template.querySelectorAll("lightning-input-field");

if (inputFields) {

inputFields.forEach((field) => {

field.reset;

});

}

formatting:









FIRE HIDDEN FORM BUTTON

this.template.querySelector('[data-id="oppButton"]').click;

HIDE FIELD

class="slds-hide"

 Query Selector 

dataID Dynamic            this.template.querySelector("[data-id2= " + event.currentTarget.dataset.id + "]")

dataID Hardcoded         this.template.querySelector('[data-id="oppButton"]').click;

 WIRE METHOD: 

requires: import refName from "@salesforce/apex/ClassName.FunctionNAme";

@wire(refName, {

recordId: "$applicantId"

})

refName ({ error, data }) {

if (data) {

//some code

} else if (error) {

console.log("error on apex wire")

this.error = error;

}

}

 imperative call

 NAVIAGATION 

requires: import { NavigationMixin } from "lightning/navigation";

requires: export default class myClass extends NavigationMixin(LightningElement) {

 NAV to RELATED LIST (PERSON ACCOUNTS) 

this[NavigationMixin.Navigate]({

type: 'standard__recordRelationshipPage',

attributes: {

recordId: this.applicantId,

objectApiName: '' ,

relationshipApiName: 'Fingerprint_Results__r',

actionName: 'view'

}

});

 EVENTS 

Send Event to parent

this.dispatchEvent(

new CustomEvent("questionupdate", {

detail: {

key: this.tabinfo.tabName,

value: this.questionMap

}

})

);

 LIGHTNING BUTTONS 

HTML





JavaScript

@track options = [

{ label: "Not Submitted", value: "Not Submitted" },

{ label: "Submitted", value: "Submitted" }

];

Wait for child page load:

setTimeout( => this.template.querySelector("c-tab-Content-Over-View").updateTabInfoOverview(this.currentTabInfo));

MOBILE TAG SETUP

ONE-COLLUMN











</lightning-layout-item>

</lightning-layout>

TWO-COLLUMN

<lightning-layout>

<lightning-layout-item size="6" large-device-size="6" small-device-size="12" medium-device-size="12"> left side elements here

<lightning-layout>

<lightning-layout-item>

<lightning-layout-item>

<lightning-layout>

<///close tags>

<lightning-layout-item size="6" large-device-size="6" small-device-size="12" medium-device-size="12"> right side elements here

<lightning-layout>

<lightning-layout-item>

<lightning-layout-item>

<lightning-layout>

<///close tags>

</lightning-layout>

 Important Links:

LWC Slots : https://niksdeveloper.com/salesforce/slots-in-lwc/

sub pub: https://salesforcecodes.blogspot.com/2020/06/Communication%20between%20independent%20lwc.html