Salesforce LWC : Compact Layout on Hover
Salesforce LWC : Compact Layout showing on Hover
Sometime we have requirement to show Account name link on standard views, a popup with the Compact Layout shows the details of that record.
LWC Parent Component : Template (HTML Code)
LWC : JS (Process Code)
import { LightningElement,api } from 'lwc';
export default class AccountComponent extends LightningElement {
@api recordId;
@track objRecordId;
handleMouseover(event) {
console.log(this.recordId);
this.objRecordId = null
const toolTipDiv = this.template.querySelector('div.ModelTooltip');
toolTipDiv.style.opacity = 1;
toolTipDiv.style.display = "block";
// eslint-disable-next-line
window.clearTimeout(this.delayTimeout);
// eslint-disable-next-line @lwc/lwc/no-async-operation
this.delayTimeout = setTimeout(() => {
this.objRecordId = this.recordId;
}, 50);
}
/* Handle Mouse Out*/
handleMouseout() {
const toolTipDiv = this.template.querySelector('div.ModelTooltip');
toolTipDiv.style.opacity = 0;
toolTipDiv.style.display = "none";
}
}
LWC : XML (Config Code)
51.0
true
lightning__RecordPage
LWC Child Component (CompactLayoutOnHover) : Template (HTML Code)
Account Details
LWC : JS (Process Code)
import { LightningElement,api } from 'lwc';
export default class PopoverComponent extends LightningElement {
@api recordId;
}
LWC : XML (Config Code)
51.0
false
360degree Salesforce implementation services opens doors to wide-ranging benefits for the efficiency in your business process, bringing you better results. Streamlining the business processes, managing contacts, lead management, tracking the customer timelines and activities, closing deals faster , 360degree makes it all so easy to handle. As a platform for success, customizability lets the Salesforce CRM bring together the most tools for productivity and enablement in one place.
ReplyDeletevisit-360degreecloud
Thanks for your great information.
ReplyDeleteI tried this on other object which is added it into the Opportunity object related list. but I am getting error bcz it is different object. Can you please help for this how will pass other object id . How we will get other object compact layout records hover in opportunity related list. If you give solution it is more help full to me.
ReplyDeleteHi Nidhee, were you able to get the answer to this question? i have a same requirement. Thanks.
DeleteAswindow is the Top Organization upvc entryways makers in delhi and Supply UPVC, Top of the line Entryways and Windows to Clients All around The Noida, Delhi Gurgaon and NCR. AS Window is a trailblazer in the creation of plasticized upvc window suppliers in gurugram and entryways. UPVC is a superb option in contrast to wood and metal. AS Window offers an extensive variety of wonderful and perfect home window plans that won't just change your home yet will likewise safeguard it from the rest of the world. UPVC is an all-climate, harmless to the ecosystem, intensity and commotion safe material for entryways and windows that add solace, accommodation, and style to current homes.
ReplyDeleteModel is disappeared when I mouse hover on it because of mouseout event so is there any solution so when mouse hover on model then it should not go away.
ReplyDeleteZordial offers Salesforce implementation services, consulting and managed services in India. Get expert guidance from top Salesforce implementation consultants.
ReplyDelete