You need to sign in to do that
Don't have an account?
tulasiram ch
how to pass accountid to popup window for displaying related contactList in lightning
I used following component and controller with apex class: But i am knew to lightning, Please help me how to display related contactlist with accountid in new window...
DisplayAccountsWithContacts.cmp:
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================
DisplayAccountsWithContacts.cmp:
- <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
- <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
- <aura:attribute name="accounts" type="account[]"/>
- <table>
- <tr>
- <td> Name </td>
- <td> Industry </td>
- <td> Phone</td>
- <td> CreatedDate</td>
- <td> ContactList Button</td>
- </tr> <b/>
- <aura:iteration items="{!v.accounts}" var="accs1" >
- <tr>
- <td> {!accs1.Name} </td>
- <td> {!accs1.Industry} </td>
- <td> {!accs1.Phone} </td>
- <td> {!accs1.CreatedDate}</td>
- <td> <lightning:button variant="neutral" label="ContactList" onclick="{! c.handleClick }" />
- </td>
- </tr><b/>
- </aura:iteration>
- </table>
- <aura:attribute name="isOpen" type="boolean" default="false"/>
- <div class="slds-m-around--xx-large">
- <aura:if isTrue="{!v.isOpen}">
- <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
- <div class="slds-modal__container">
- <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
- <div class="slds-modal__header">
- <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2 id="header99" class="slds-text-heading--medium">ContactList</h2>
- <!--###### MODAL BOX FOOTER Part Start From Here ######-->
- <div class="slds-modal__footer">
- <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
- <button class="slds-button slds-button--brand" onclick="{!c.likenClose}">Like and Close</button>
- </div>
- </div>
- </div>
- </div>
- </aura:if>
- </div>
- </aura:component>
- ({
- myAction : function(component, event, helper) {
- var action =component.get("c.getAllAccounts");
- console.log('The action value is: '+action);
- action.setCallback(this, function(a){
- component.set("v.accounts", a.getReturnValue());
- // console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- });
- $A.enqueueAction(action);
- },
- handleClick : function(component, event, helper) {
- component.set("v.isOpen", true); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- } ,
- closeModel: function(component, event, helper) {
- component.set("v.isOpen", false); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- },
- likenClose: function(component, event, helper) {
- alert('thanks for like Us :)');// Display alert message on the click on the "Like and Close" button from Model Footer
- // and set set the "isOpen" attribute to "False for close the model Box.
- component.set("v.isOpen", false);
- },
- })
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================
Solved...exactly what i wanted...
All Answers
May I suggest you please refer the below link for reference.
- https://developer.salesforce.com/forums/?id=9060G000000XdAfQAK
- https://salesforce.stackexchange.com/questions/115092/how-to-display-modal-popup-with-a-form-inside-a-lightning-component
Hope it will be helpful.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar
associated with a particular account.
Solved...exactly what i wanted...
HI tulasiram,
I have same senrio . but i am unbale to open that link(whate you provide best answer).
Could you please advice .