You need to sign in to do that
Don't have an account?
Simha Yadav
The moment when i click Edit link in below pic all related field values should populate in below section. i,e 'my content section'. and it should allow to save record.
Hi Folks urgent requirement please help me and below is my code and pic.
<apex:page controller="Pagination_min" showHeader="false" sidebar="false" extensions="AccountController">
<apex:form >
<apex:outputpanel >
<apex:pageBlock id="abc">
<apex:pageBlockSection columns="1" title="Accounts" >
<apex:pageBlockTable value="{!accounts}" var="a" >
<apex:column >
<apex:outputLink title="" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
</apex:column>
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Type}"/>
<apex:column value="{!a.BillingCity}"/>
<apex:column value="{!a.BillingState}"/>
<apex:column value="{!a.BillingCountry}"/>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" action="{!setcon.first}" disabled="{!!setcon.hasPrevious}" title="First page" reRender="abc"/>
<apex:commandButton value="<" action="{!setcon.previous}" disabled="{!!setcon.hasPrevious}" title="Previous page" reRender="abc"/>
<apex:commandButton value=">" action="{!setcon.next}" disabled="{!!setcon.hasNext}" title="Next page" reRender="abc"/>
<apex:commandButton value=">|" action="{!setcon.last}" disabled="{!!setcon.hasNext}" title="Last page" reRender="abc"/>
<apex:outputText >{!(setCon.pageNumber * size)+1-size} - {!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText>
<apex:commandButton value="Refresh" action="{!refresh}" title="Refresh Page" reRender="abc"/>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:pageBlock title="Account Creation Section" mode="edit" id="simha">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" reRender="simha" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}" required="false"/>
<apex:inputField value="{!account.type}"/>
<apex:inputField value="{!account.Billingcity}"/>
<apex:inputField value="{!account.billingstate}"/>
<apex:inputField value="{!account.billingcountry}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
*****************************************************
public class Pagination_min {
Public Integer noofRecords {get; set;}
public integer size {get; set;}
public Apexpages.standardsetController setcon{
get{
if(setCon == null){
size = 10;
String queryString = 'Select Name, Type, BillingCity, BillingState, BillingCountry from Account order by Name';
setcon = new apexpages.standardsetController(Database.getquerylocator(queryString));
setcon.setpagesize(size);
noofRecords = setcon.getResultsize();
}
return setcon;
}
set;
}
Public list<Account> getAccounts(){
list<Account> acclist = new list<Account>();
for(Account ac : (list<Account>)setcon.getrecords()){
acclist.add(ac);
}
return accList;
}
Public PageReference Refresh(){
setcon=null;
getAccounts();
setcon.setpageNumber(1);
return null;
}
}
**********************************************************
public with sharing class AccountController {
public Account account{get; set;}
public AccountController(Pagination_min controller) {
account = new Account();
}
public PageReference save(){
upsert account;
account = null;
return null;
}
}
<apex:page controller="Pagination_min" showHeader="false" sidebar="false" extensions="AccountController">
<apex:form >
<apex:outputpanel >
<apex:pageBlock id="abc">
<apex:pageBlockSection columns="1" title="Accounts" >
<apex:pageBlockTable value="{!accounts}" var="a" >
<apex:column >
<apex:outputLink title="" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> |
</apex:column>
<apex:column value="{!a.Name}"/>
<apex:column value="{!a.Type}"/>
<apex:column value="{!a.BillingCity}"/>
<apex:column value="{!a.BillingState}"/>
<apex:column value="{!a.BillingCountry}"/>
</apex:pageBlockTable>
<apex:panelGrid columns="7">
<apex:commandButton value="|<" action="{!setcon.first}" disabled="{!!setcon.hasPrevious}" title="First page" reRender="abc"/>
<apex:commandButton value="<" action="{!setcon.previous}" disabled="{!!setcon.hasPrevious}" title="Previous page" reRender="abc"/>
<apex:commandButton value=">" action="{!setcon.next}" disabled="{!!setcon.hasNext}" title="Next page" reRender="abc"/>
<apex:commandButton value=">|" action="{!setcon.last}" disabled="{!!setcon.hasNext}" title="Last page" reRender="abc"/>
<apex:outputText >{!(setCon.pageNumber * size)+1-size} - {!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText>
<apex:commandButton value="Refresh" action="{!refresh}" title="Refresh Page" reRender="abc"/>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:pageBlock title="Account Creation Section" mode="edit" id="simha">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save" reRender="simha" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}" required="false"/>
<apex:inputField value="{!account.type}"/>
<apex:inputField value="{!account.Billingcity}"/>
<apex:inputField value="{!account.billingstate}"/>
<apex:inputField value="{!account.billingcountry}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
*****************************************************
public class Pagination_min {
Public Integer noofRecords {get; set;}
public integer size {get; set;}
public Apexpages.standardsetController setcon{
get{
if(setCon == null){
size = 10;
String queryString = 'Select Name, Type, BillingCity, BillingState, BillingCountry from Account order by Name';
setcon = new apexpages.standardsetController(Database.getquerylocator(queryString));
setcon.setpagesize(size);
noofRecords = setcon.getResultsize();
}
return setcon;
}
set;
}
Public list<Account> getAccounts(){
list<Account> acclist = new list<Account>();
for(Account ac : (list<Account>)setcon.getrecords()){
acclist.add(ac);
}
return accList;
}
Public PageReference Refresh(){
setcon=null;
getAccounts();
setcon.setpageNumber(1);
return null;
}
}
**********************************************************
public with sharing class AccountController {
public Account account{get; set;}
public AccountController(Pagination_min controller) {
account = new Account();
}
public PageReference save(){
upsert account;
account = null;
return null;
}
}
Public ID My_Content_ID{get;set;}
Public PageReference Populate_Contant ()
{
//you already have get;set account variable which displays fields of account in My content section
account=[query account fields where Id:= My_Content_ID]
after this query account variable will have the values tobe displayed in My Content section hence rerendering My Content section will refresh all the inputs with relevent values
}
--Vf Code --
// I assume "simha" is the id of page block where you are displaying the "My Content"
Replace --> <apex:commandLink value="Edit" action="{!Populate_Contant}" rerender="simha" >
<apex:param name="AccountID" value="{!a.id}" assignTo="{!My_Content_ID}"/> //
</apex:commandLink>
With --> <apex:outputLink title="" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>
For example:
You have to pass parameters to this detail component whcih needs to be updated.
Thanks,
Brahma