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

List of records using links in visualforce page
Hi,
I am trying to develop a visual force page in which the list of records should be displayed on the click of the object name.
The same functionality is working fine with the check box,but i want it to be done with links.
This is my code which is displaying the list of records when the check box is checked.
<apex:page controller="multirecords" >
<apex:form >
<apex:messages />
<apex:pageBlock id="theBlock">
<apex:inputCheckbox value="{!Check}" required="false">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:inputCheckbox>
<apex:outputLabel value="View Job Application" style="font-weight:bold;"></apex:outputLabel> <br/>
<apex:inputCheckbox value="{!Check1}" required="false">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:inputCheckbox>
<apex:outputLabel value="View Positions" style="font-weight:bold;"></apex:outputLabel> <br/>
<!-- <apex:commandLink value="Positions" action="{!display}" id="position" rendered="{!inputmode}">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:commandLink>-->
<apex:pageBlock title="Job Application" rendered="{!(Check == true)}">
<apex:pageblockTable value="{!ja}" var="a">
<apex:column value="{!a.Name}"/>
</apex:pageblockTable><br/>
</apex:pageBlock>
<apex:pageBlock title="Position" rendered="{!(Check1 == true)}">
<apex:pageblockTable value="{!pos}" var="p">
<apex:column value="{!p.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>
---Controller--
public class multirecords {
public List<Job_Application__c> ja {get; set;}
public List<Position__c> pos {get; set;}
public List<Review__c> rev {get; set;}
public boolean Check{get;set;}
public boolean Check1{get;set;}
public boolean Check2{get;set;}
public multirecords()
{
ja = [SELECT Name FROM Job_Application__c];
pos = [SELECT Name FROM Position__c];
}
}
I am trying to develop a visual force page in which the list of records should be displayed on the click of the object name.
The same functionality is working fine with the check box,but i want it to be done with links.
This is my code which is displaying the list of records when the check box is checked.
<apex:page controller="multirecords" >
<apex:form >
<apex:messages />
<apex:pageBlock id="theBlock">
<apex:inputCheckbox value="{!Check}" required="false">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:inputCheckbox>
<apex:outputLabel value="View Job Application" style="font-weight:bold;"></apex:outputLabel> <br/>
<apex:inputCheckbox value="{!Check1}" required="false">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:inputCheckbox>
<apex:outputLabel value="View Positions" style="font-weight:bold;"></apex:outputLabel> <br/>
<!-- <apex:commandLink value="Positions" action="{!display}" id="position" rendered="{!inputmode}">
<apex:actionSupport event="onclick" rerender="theBlock"/>
</apex:commandLink>-->
<apex:pageBlock title="Job Application" rendered="{!(Check == true)}">
<apex:pageblockTable value="{!ja}" var="a">
<apex:column value="{!a.Name}"/>
</apex:pageblockTable><br/>
</apex:pageBlock>
<apex:pageBlock title="Position" rendered="{!(Check1 == true)}">
<apex:pageblockTable value="{!pos}" var="p">
<apex:column value="{!p.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>
---Controller--
public class multirecords {
public List<Job_Application__c> ja {get; set;}
public List<Position__c> pos {get; set;}
public List<Review__c> rev {get; set;}
public boolean Check{get;set;}
public boolean Check1{get;set;}
public boolean Check2{get;set;}
public multirecords()
{
ja = [SELECT Name FROM Job_Application__c];
pos = [SELECT Name FROM Position__c];
}
}
Use the following code to get List of records using links in visualforce page. Hope this will help you.
CONTROLLER--
public class multirecords {
public List<Job_Application__c> ja {get; set;}
public List<Position__c> pos {get; set;}
public List<Review__c> rev {get; set;}
public boolean Check{get;set;}
public boolean Check1{get;set;}
public boolean Check2{get;set;}
public multirecords(){
ja = [SELECT Name FROM Job_Application__c];
pos = [SELECT Name FROM Position__c];
}
Public void showPositions(){
if(Check1 == true){Check1 = false;}
else{Check1 = true;}
}
Public void showJobApp(){
if(Check2 == true){Check2 = false;}
else{Check2 = true;}
}
}
APEX PAGE--
<apex:page controller="multirecords" >
<apex:form >
<apex:messages />
<apex:pageBlock >
<apex:commandLink value="Positions" action="{!showPositions}" reRender="PGB2"/><br/>
<apex:commandLink value="Job applications" action="{!showJobApp}" reRender="PGB2"/><br/>
</apex:pageBlock>
<apex:outputPanel id="PGB2">
<apex:pageBlock id="position" rendered="{!Check1}">
<apex:pageblockTable value="{!pos}" var="p">
<apex:column value="{!p.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock id="jobApp" rendered="{!Check2}">
<apex:pageblockTable value="{!ja}" var="j">
<apex:column value="{!j.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
And don't forget to mark this answer as best, if answer this helps you :-)
--
Regards,
Grazitti Team
Web: www.grazitti.com
All Answers
Use the following code to get List of records using links in visualforce page. Hope this will help you.
CONTROLLER--
public class multirecords {
public List<Job_Application__c> ja {get; set;}
public List<Position__c> pos {get; set;}
public List<Review__c> rev {get; set;}
public boolean Check{get;set;}
public boolean Check1{get;set;}
public boolean Check2{get;set;}
public multirecords(){
ja = [SELECT Name FROM Job_Application__c];
pos = [SELECT Name FROM Position__c];
}
Public void showPositions(){
if(Check1 == true){Check1 = false;}
else{Check1 = true;}
}
Public void showJobApp(){
if(Check2 == true){Check2 = false;}
else{Check2 = true;}
}
}
APEX PAGE--
<apex:page controller="multirecords" >
<apex:form >
<apex:messages />
<apex:pageBlock >
<apex:commandLink value="Positions" action="{!showPositions}" reRender="PGB2"/><br/>
<apex:commandLink value="Job applications" action="{!showJobApp}" reRender="PGB2"/><br/>
</apex:pageBlock>
<apex:outputPanel id="PGB2">
<apex:pageBlock id="position" rendered="{!Check1}">
<apex:pageblockTable value="{!pos}" var="p">
<apex:column value="{!p.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock id="jobApp" rendered="{!Check2}">
<apex:pageblockTable value="{!ja}" var="j">
<apex:column value="{!j.Name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:outputPanel>
</apex:form>
</apex:page>
And don't forget to mark this answer as best, if answer this helps you :-)
--
Regards,
Grazitti Team
Web: www.grazitti.com
If it was helpful, can you mark this as anwer.
--
Regards,
Grazitti Team
Web: www.grazitti.com