Map Scenario
Scenario:
Create field dependency using vf page
Create field dependency using vf page
public class MapEaxmple {
public
Map<String, Account>
accMap{set;get;}
public
List<SelectOption> sp{set;get;}
public Account
accs{set;get;}
public String
selected{set;get;}
public String
result{set;get;}
public MapEaxmple(){
accMap=new
Map<String, Account>();
sp=new
List<SelectOption>();
Account a1=new
Account(name='emilyn', phone='903030');
Account a2=new
Account(name='aabbcc', phone='78576');
accMap.put('First', a1);
accMap.put('Sec', a2);
Set<String> keys=accMap.keySet();
for(String
s:keys){
SelectOption sop=new SelectOption(s,s);
sp.add(sop);
}
}
public void
data(){
accs=accMap.get(selected);
}
}
<apex:page controller="MapEaxmple">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:selectList
value="{!selected}" size="1">
<apex:selectOptions
value="{!sp}"
></apex:selectOptions>
<apex:actionSupport event="onchange"
action="{!data}" reRender="one" />
</apex:selectList>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!accs}" var="a"
id="one">
<apex:column headerValue="name" value="{!a.name}"
/>
<apex:column headerValue="Phone"
value="{!a.phone}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Great post. Thanks for sharing the post
ReplyDeletesalesforce interview questions
bootstrap interview questions
spring interview questions and answers for experienced
Thanks for sharing such a great blog
ReplyDeletepython training in bangalore | python online Training
artificial intelligence training in bangalore | artificial intelligence online training
machine learning training in bangalore | machine learning online training
uipath-training-in-bangalore | uipath online training
blockchain training in bangalore | blockchain online training
aws training in Bangalore | aws online training
data science training in bangalore | data science online training
hadoop training in bangalore | hadoop online training
iot training in bangalore | iot online training
devops training in banaglore | devops online training