You need to sign in to do that
Don't have an account?

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 ;
}
}
<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 ;
}
}
Check spelling 'onchange' in event="onchnage".
Use Recordtype.id instead of Recordtype.Name.
Thanks
Ankur Saini
http://mirketa.com
try this:
Thanks
Ankur Saini
http://mirketa.com