Visualforce Page:
<apex:page standardController="Account" Extensions="nextcls" recordSetVar="accs" >
<apex:form >
<Apex:pageBlock id="pb" >
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column headerValue="Action" width="100">
<apex:commandLink value="Edit" action="{!editrec}" style="color:#015BA7">
<apex:param value="{!a.id}" assignTo="{!recordid}" name="p"/>
</apex:commandLink>
|
<apex:commandLink value="Del" action="{!delrec}" style="color:#015BA7">
<apex:param value="{!a.id}" assignTo="{!recordid}" name="p1"/>
</apex:commandLink>
</apex:column>
<apex:column headerValue="Account Name" width="300" >
<apex:commandLink value="{!a.name}" rerender="out" status="stat">
<apex:param value="{!a.id}" name="p2"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!a.phone}"/>
<apex:column value="{!a.fax}"/>
</apex:pageBlockTable>
<apex:commandLink action="{!previous}" reRender="pb">
<apex:image value="{!$Resource.prev}" style="height:25px; width:25px:"/>
</apex:commandLink>
<apex:commandLink action="{!NEXT}" reRender="pb">
<apex:image value="{!$Resource.next}" style="height:25px; width:25px:"/>
</apex:commandLink>
</Apex:pageBlock>
<div align="center">
<apex:outputPanel id="out">
<apex:actionStatus id="stat" >
<apex:facet name="start">
<apex:image value="{!$Resource.Loading}" style="width:250px; height:200px"/>
</apex:facet>
<apex:facet name="stop">
<apex:detail subject="{!$CurrentPage.Parameters.p2}" relatedList="false" inlineEdit="true"/>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</div>
</apex:form>
</apex:page>
Apex Class:
public with sharing class nextcls {
public string recordid{get; set;}
public nextcls(ApexPages.StandardSetController controller) {
controller.setPagesize(5);
}
public pagereference editrec(){
System.debug('.......................'+recordid);
pagereference ref = new pagereference('/'+recordid+'/e');
return ref;
}
public pagereference delrec(){
System.debug('.......................'+recordid);
Account acc =[select id from Account where id=:recordid];
delete acc;
pagereference ref= new pagereference('/apex/records2');
ref.setredirect(true);
return ref;
}
}
No comments:
Post a Comment