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

pagination in visualforce
Hi,
I have developed a visual force page and am tring to pagination my page but am not getting
this concept plase help me.
this is my code all contacts update
<apex:page controller="contactstoupdate" showHeader="false" sidebar="false">
<apex:form >
<apex:pageBlock rendered="{!clist}">
<apex:pageBlockTable value="{!conlist}" var="acc">
<apex:column headerValue="Contacts" >
<apex:commandLink value="{!acc.name}" action="{!condetail}">
<apex:param name="conname" value="{!acc.id}"/>
</apex:commandlink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:panelGrid columns="4">
<apex:commandLink action="{!first}">First</apex:commandlink>
<apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
<apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
<apex:commandLink action="{!last}">Last</apex:commandlink>
</apex:panelGrid>
<apex:pageblock rendered="{!condetail}" title="Contact detail page" >
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!Edit}"/>
</apex:pageBlockButtons>
<apex:pageblockSection >
<apex:outputField value="{!con.lastname}"/>
<apex:outputField value="{!con.phone}"/>
<apex:outputField value="{!con.email}"/>
</apex:pageblockSection>
</apex:pageblock>
<apex:pageBlock rendered="{!conedit}">
<apex:pageblockButtons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="back" action="{!back}"/>
</apex:pageblockButtons>
<apex:pageblockSection >
<apex:inputField value="{!con.lastname}"/>
<apex:inputField value="{!con.phone}"/>
<apex:inputField value="{!con.email}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
======================================================
public class contactstoupdate
{
public boolean clist{set;get;}
public boolean condetail{set;get;}
public boolean conedit{set;get;}
//public boolean hasprevious{set;get;}
//public boolean hasnext{set;get;}
list<contact> conlist=new list<contact>();
contact con=new contact();
public contactstoupdate()
{
clist=true;
condetail=false;
conedit=false;
for(contact c:[select id,name from contact])
conlist.add(c);
system.debug('@@@@@@'+conlist);
}
public ApexPages.StandardSetController con1 {
get {
if(con1==null)
{
con1 = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id, Name FROM Contact limit 100]));
// sets the number of records in each page set
con1.setPageSize(5);
}
return con1;
}
set;
}
public Boolean hasNext {
get {
return con1.getHasNext();
}
set;
}
public Boolean hasPrevious {
get {
return con1.getHasPrevious();
}
set;
}
public Integer pageNumber {
get {
return con1.getPageNumber();
}
set;
}
public list<contact> getconlist()
{
return conlist;
}
public void condetail()
{
clist=false;
condetail=true;
id i=Apexpages.currentpage().getparameters().get('conname');
con=[select id,lastname,phone,email from contact where id=:i];
}
public void edit()
{
conedit=true;
condetail=false;
clist=false;
}
public void back()
{
condetail=true;
conedit=false;
clist=false;
}
public void save()
{
condetail=true;
conedit=false;
clist=false;
update con;
}
public contact getcon()
{
return con;
}
public void first()
{
con1.first();
}
public void previous()
{
con1.previous();
}
public void next()
{
con1.next();
}
public void last()
{
con1.last();
}
}
Thank you.
Hi try this code in opportunity object
Thank you it's working i found my error.