You need to sign in to do that
Don't have an account?
Roopa S 1
need to add " previous and next" buttons and display only 10 records per page
this is the apex controller i have written
public class popupExt {
public string accId {get;set;}
Public contact popUpAcc {get; set;}
public boolean displayPopup {get; set;}
public List<Account> lstAccount;
public Integer countTotalRecords{get;set;}
public Integer offSetSize = 0;
public Integer QueryLimit = 10;
public popupExt(ApexPages.StandardSetController stdController) {
}
public void closePopup() {
displayPopup = false;
}
public void showPopup() {
displayPopup = true;
popUpAcc = [SELECT Id, Name, Phone, Email FROM Contact where id =: accId ];
}
public void SoqlPaginationOffsetController(){
lstAccount = new List<Account>();
countTotalRecords = [SELECT count() FROM Account];
}
public List<Account> getAccounts(){
lstAccount = [SELECT Id, Name, Phone FROM Account ORDER BY Name LIMIT :QueryLimit OFFSET :offSetSize];
return lstAccount;
}
public boolean getprv(){
if(offSetSize > 0)
return false;
else
return true;
}
public boolean getnxt(){
if(offSetSize + queryLimit < CountTotalRecords)
return false;
else
return true;
}
public PageReference nextbtn(){
offSetSize += queryLimit ;
return null;
}
public PageReference prvbtn(){
offSetSize -= queryLimit ;
return null;
}
public PageReference fstbtn(){
offSetSize = 0;
return null;
}
public PageReference endbtn(){
offSetSize = countTotalRecords - math.mod(countTotalRecords,queryLimit);
return null;
}
}
VF page
<apex:page standardController="Account" extensions="popupExt" recordSetVar="accnt" tabStyle="Account" >
<apex:form >
<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displaypopup}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displaypopup}">
<p>Account Name : {!popUpAcc.Name}</p>
<p>Phone : {!popUpAcc.Phone}</p>
<apex:commandButton value="ok" action="{!closePopup}" rerender="tstpopup"/>
</apex:outputPanel>
</apex:outputPanel>
<apex:pageBlock title="Accounts" >
<apex:pageBlockTable value="{!accnt}" var="ac" >
<apex:column id="two">
<apex:commandButton title="{!ac.id}" value="Click" action="{!showPopup}" rerender="tstpopup">
<apex:param name="accId" value="{!ac.id}" assignTo="{!accId}"/>
</apex:commandButton>
</apex:column>
<apex:column value="{!ac.Name}" />
<apex:column value="{!ac.AccountNumber}" />
<apex:column value="{!ac.Type}" />
<apex:column value="{!ac.Rating}" />
<apex:column value="{!ac.Phone}" />
<apex:column value="{!ac.billingCity}" />
<apex:column value="{!ac.billingCountry}" />
</apex:pageBlockTable>
<apex:commandButton value="First" action="{!fstbtn}" disabled="{!prv}" reRender="pt,pb" />
<apex:commandButton value="Previous" action="{!prvbtn}" disabled="{!prv}" reRender="pt,pb" />
<apex:commandButton value="Next" action="{!nextbtn}" disabled="{!nxt}" reRender="pt,pb" />
<apex:commandButton value="End" action="{!endbtn}" disabled="{!nxt}" reRender="pt,pb" />
</apex:pageBlock>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
/* These are the 3 css properties you will need to change so the popup
displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can add
the height property for a fixed size pop up if you want.*/
width: 500px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>
after clicking " CLICk" button contacts related to that particular should display in pop up. now contacts details are not displaying please help me
need to add " previous and next" buttons and display only 10 records per page
this is the apex controller i have written
public class popupExt {
public string accId {get;set;}
Public contact popUpAcc {get; set;}
public boolean displayPopup {get; set;}
public List<Account> lstAccount;
public Integer countTotalRecords{get;set;}
public Integer offSetSize = 0;
public Integer QueryLimit = 10;
public popupExt(ApexPages.StandardSetController stdController) {
}
public void closePopup() {
displayPopup = false;
}
public void showPopup() {
displayPopup = true;
popUpAcc = [SELECT Id, Name, Phone, Email FROM Contact where id =: accId ];
}
public void SoqlPaginationOffsetController(){
lstAccount = new List<Account>();
countTotalRecords = [SELECT count() FROM Account];
}
public List<Account> getAccounts(){
lstAccount = [SELECT Id, Name, Phone FROM Account ORDER BY Name LIMIT :QueryLimit OFFSET :offSetSize];
return lstAccount;
}
public boolean getprv(){
if(offSetSize > 0)
return false;
else
return true;
}
public boolean getnxt(){
if(offSetSize + queryLimit < CountTotalRecords)
return false;
else
return true;
}
public PageReference nextbtn(){
offSetSize += queryLimit ;
return null;
}
public PageReference prvbtn(){
offSetSize -= queryLimit ;
return null;
}
public PageReference fstbtn(){
offSetSize = 0;
return null;
}
public PageReference endbtn(){
offSetSize = countTotalRecords - math.mod(countTotalRecords,queryLimit);
return null;
}
}
VF page
<apex:page standardController="Account" extensions="popupExt" recordSetVar="accnt" tabStyle="Account" >
<apex:form >
<apex:outputPanel id="tstpopup">
<apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displaypopup}"/>
<apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displaypopup}">
<p>Account Name : {!popUpAcc.Name}</p>
<p>Phone : {!popUpAcc.Phone}</p>
<apex:commandButton value="ok" action="{!closePopup}" rerender="tstpopup"/>
</apex:outputPanel>
</apex:outputPanel>
<apex:pageBlock title="Accounts" >
<apex:pageBlockTable value="{!accnt}" var="ac" >
<apex:column id="two">
<apex:commandButton title="{!ac.id}" value="Click" action="{!showPopup}" rerender="tstpopup">
<apex:param name="accId" value="{!ac.id}" assignTo="{!accId}"/>
</apex:commandButton>
</apex:column>
<apex:column value="{!ac.Name}" />
<apex:column value="{!ac.AccountNumber}" />
<apex:column value="{!ac.Type}" />
<apex:column value="{!ac.Rating}" />
<apex:column value="{!ac.Phone}" />
<apex:column value="{!ac.billingCity}" />
<apex:column value="{!ac.billingCountry}" />
</apex:pageBlockTable>
<apex:commandButton value="First" action="{!fstbtn}" disabled="{!prv}" reRender="pt,pb" />
<apex:commandButton value="Previous" action="{!prvbtn}" disabled="{!prv}" reRender="pt,pb" />
<apex:commandButton value="Next" action="{!nextbtn}" disabled="{!nxt}" reRender="pt,pb" />
<apex:commandButton value="End" action="{!endbtn}" disabled="{!nxt}" reRender="pt,pb" />
</apex:pageBlock>
</apex:form>
<style type="text/css">
.custPopup{
background-color: white;
border-width: 2px;
border-style: solid;
z-index: 9999;
left: 50%;
padding:10px;
position: absolute;
/* These are the 3 css properties you will need to change so the popup
displays in the center of the screen. First set the width. Then set
margin-left to negative half of what the width is. You can add
the height property for a fixed size pop up if you want.*/
width: 500px;
margin-left: -250px;
top:100px;
}
.popupBackground{
background-color:black;
opacity: 0.20;
filter: alpha(opacity = 20);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 9998;
}
</style>
</apex:page>