How to open child records list from custom button on parent object?

Custom Button:



Visualforce page:

<apex:page controller="InterestListController">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listInterest}" var="int">
            <apex:column value="{!int.Name}"/>
            <apex:column value="{!int.Description__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>      
</apex:page>

Apex Controller:

public class InterestListController {
    Id memId;
    public List<Interest__c> listInterest {get;set;}
    public InterestListController(){
        listInterest = new List<Interest__c>();
        memId = ApexPages.currentPage().getParameters().get('memId');
        listInterest = [SELECT Name, Description__c FROM Interest__c WHERE Member__c = : memId];
    }
}


Output:




2 comments:

  1. is there any difference between list1= list2; and list1 = list2.clone();

    ReplyDelete
    Replies
    1. Both are same!!!

      Check this!!!

      http://www.infallibletechie.com/2014/08/difference-between-clone-and-deepclone.html

      Cheers!!!

      Delete