function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PRIYAN NEERUDUPRIYAN NEERUDU 

m using the below code and tryimg to render a pageblock section item at on change evet but m unable to render....can anyone plz help me out wth this....

<apex:page controller="getrecordtype">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
YEAR
<apex:selectList Size="1">
<apex:selectOptions value="{!items}">
</apex:selectOptions>
 </apex:selectList>
 </apex:pageBlockSectionItem>
 <apex:pageBlockSectionItem >
RECORD TYPE
<apex:selectList size="1" >
<apex:selectOptions value="{!RecordTypeItems}">
</apex:selectOptions>
<apex:actionSupport event="onchnage" rendered="amountfields"/>
 </apex:selectList>
 </apex:pageBlockSectionItem>
 
<apex:pageBlockSectionItem id="amountfields">
<apex:repeat value="{!getamount}" var="a">
<td>{!a.s}</td>
<td>{!a.a}</td>
<td>{!a.c}</td>
</apex:repeat>
</apex:pageBlockSectionItem>

 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
</apex:page>

--------------------------------------------------------------------


public with sharing class getrecordtype {
map<id,AggregateResult> clist1 = new map<id,AggregateResult>();
   
    List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
    public string selectedrecordtype {get;set;}
    public String getRecordTypeSelectedId(){
  String recordTypeName;
    String rtId;
    //List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
    for(RecordType rt : rtList) {
        if(rt.Name == recordTypeName) {
             rtId = rt.Id;
        }
    }
    return rtId;        
}
    
    public List<SelectOption> getRecordTypeItems() {
        List<SelectOption> options = new List<SelectOption>();
        for(RecordType r : rtList){
           options.add(new SelectOption(''+r.ID,r.name)); 
        }
        return options;
    }
    

public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('2014','2014'));
            options.add(new SelectOption('2015','2015'));
            options.add(new SelectOption('2016','2016'));
            return options;
        }
          
  public map<id,AggregateResult> getGetamount() {
  if(selectedrecordtype !=null){
          for(AggregateResult ar :[select sum(PAID_AMOUNT__c) s ,sum(BALANCE_AMOUNT__c) a ,
          sum(amount__c) c,accountid  from contact where  Recordtype.Name = :selectedrecordtype group by accountid] ){
          clist1.put((Id)ar.get('accountid'),ar);
        }
           } return clist1;

    }
public map<id,AggregateResult> getdetails(){
return clist1 ;
}
            
 
}
Ankur Saini 9Ankur Saini 9
Hi

Check spelling 'onchange' in event="onchnage".

Use Recordtype.id instead of Recordtype.Name.

Thanks
Ankur Saini
http://mirketa.com
PRIYAN NEERUDUPRIYAN NEERUDU
its showing this error:Unknown property 'String.s'..........i have a dought hw we render map <> in vf page.......
Ankur Saini 9Ankur Saini 9
Hi PRIYAN NEERUDU

try this:
 
public with sharing class getrecordtype2 {
public List<Contact> clist1 {get;set;}
   
    List<RecordType> rtList = New List<RecordType>([Select ID, Name From RecordType Where sObjectType = 'contact']);
    public string selectedrecordtype {get;set;}
   
    public List<SelectOption> getRecordTypeItems() {
        List<SelectOption> options = new List<SelectOption>();
        for(RecordType r : rtList){
           options.add(new SelectOption(r.ID,r.name)); 
        }
        return options;
    }
    

public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('2014','2014'));
            options.add(new SelectOption('2015','2015'));
            options.add(new SelectOption('2016','2016'));
            return options;
        }
          
  public List<Contact> getGetamount() {
  clist1=new List<Contact>();
  if(selectedrecordtype !=null){
          for(Contact ar :[select PAID_AMOUNT__c,BALANCE_AMOUNT__c ,amount__c,accountid from contact where Recordtype.id= :selectedrecordtype] ){
          clist1.add(ar);
        }
           } 
           return clist1;

    }            
}


<apex:page controller="getrecordtype2">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
YEAR
<apex:selectList Size="1">
<apex:selectOptions value="{!items}">
</apex:selectOptions>
 </apex:selectList>
 </apex:pageBlockSectionItem>
 <apex:pageBlockSectionItem >
RECORD TYPE
<apex:selectList size="1" value="{!selectedrecordtype}">
<apex:selectOptions value="{!RecordTypeItems}">
</apex:selectOptions>
<apex:actionSupport event="onchange" reRender="amountfields"/>
 </apex:selectList>
 </apex:pageBlockSectionItem>
 

<apex:pageBlockTable value="{!getamount}" var="a" id="amountfields">
<apex:column value="{!a.accountid}"/>
<apex:column value="{!a.amount__c}"/>
<apex:column value="{!a.PAID_AMOUNT__c}"/>
<apex:column value="{!a.BALANCE_AMOUNT__c}"/>

</apex:pageBlockTable>


 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
</apex:page>
Thanks 
Ankur Saini
http://mirketa.com
 
PRIYAN NEERUDUPRIYAN NEERUDU
thnk you so much it was very helpfull...