You need to sign in to do that
Don't have an account?
How to refresh table data based on picklist value selected?
Hi,
My Requirement is to display two picklist on a VF page, one below the other, the second onee being the dependent one and then upon the selection of second picklist i.e. the dependent picklist, a table should be displayed with related data, and it should change whenever the second option is changed.
so when the value from second pickllist is selected , the data of name and mark__c field from the object CIMMAN__c object should be displayed. where the tick__c value is equal to the selected value from the second picklist(selected). I tried but its apparently not working out, actionsupport i tried but i guess i am just not doing it right. Thanks
I have the code till dependent picklist
<apex:page sidebar="false" Controller="TickController" > <apex:form> <apex:actionFunction action="{!createDependPick}" name="generateDependPick" reRender="pick2" /> Select the Pick1: <apex:selectList id="pick1" value="{!Selected1}" size="1" onchange="generateDependPick()"> <apex:selectOptions value="{!selectoption1}"> </apex:selectOptions> </apex:selectList> Select the Pick2: <apex:selectList id="pick2" value="{!Selected2}" size="1" > <apex:selectOptions value="{!selectoption2}"> </apex:selectOptions> </apex:selectList> </apex:page>
Controller
public class TickController { public List<SelectOption> selectoption1 {get; set;} public List<SelectOption> selectoption2 {get; set;} public String Selected1 {get; set;} public String Selected2 {get; set;} public Tickcontroller(){ selectoption1 = new List<SelectOption>(); selectoption2 = new List<SelectOption>(); SelectOption option = new SelectOption('--None--', '--None--'); selectoption1.add(option); selectoption2.add(option); option = new SelectOption('1', '1'); selectoption1.add(option); option = new SelectOption('2', '2'); selectoption1.add(option); } public void createDependPick(){ selectoption2.clear(); selectoption2.add(new SelectOption('--None--', 'None')); if(Selected1 == '1'){ selectoption2.add(new SelectOption('TDK','TDK')); selectoption2 .add(new SelectOption('OUTIA','OUTIA')); } else if( Selected1 == '2'){ selectoption2 .add(new SelectOption('GNR','GNS')); selectoption2 .add(new SelectOption('SOTD','SOTD')); } } }
try below sample code :
apex : i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
All Answers
Try the code below:-
Kindly mark it as best if found helpful.
Thanks
Ajay
try below sample code :
apex : i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
Please check again.
same as above
output:
i hope it helps you.
Let me inform if it helps you and kindly mark it best answer if it helps you
thanks
Hopes it helps you
Thanks
Thanks