+ Start a Discussion
Nagma KhanNagma Khan 

how to show the each contact record on the visualfroce and each particular record have a button edit and save and delete ?


how to show each contacts on the visualfroce page and each particular record have a button for edit and delete and save  ??

id ,lastName,firstName
112222xhd , xyz , yyy              edit ,delete,save
same another records .............. how to possible please suggest me


Ankur Saini 9Ankur Saini 9
Hi Nagma,

You want a visualforce page having list of records in a table with edit, delete and save button ?

Ankur Saini
Nagma KhanNagma Khan
yes  Ankur
Hi Nagma,

You need to use Wrapper class in this case. Please follow below instructions:
  • Create wrapper class for the defined fields to be displayed on VF page. 
  • Populate wrapper with the object records and make is visible (public), always make a field for record ID that will be saved after changes. .
  • Use apex:repeat on VF page and display records and its fields. 
  • Add three custom button links for edit, delete, and save and its handling function on Controller side. 
  • Make a list of records Id, that are modified. 
  • When the final changes are done. On Page save populate the changes on to the object for records being modified. 
Hope this helps!!!

For more info you can directly contact me on skype: gaurav62990

Ankur Saini 9Ankur Saini 9
Hi Nagma,

Tyr this one

VF Page:
<apex:page standardController="Account" extensions="AccountListController" >
    <apex:form id="form">
        <apex:pageBlock title="Acconut List" id="account_list">
            <apex:pageBlockTable value="{!accList}" var="account" id="table">
                <apex:column headerValue="Action">
                    <apex:commandLink value="Edit" reRender="account_list" rendered="{!account.id!=editList}">
                    <apex:param assignTo="{!editList}" name="Edit"
                    value="{!account.id}" />
                    <apex:commandLink value="Save" reRender="account_list" rendered="{!account.id==editList}" action="{!saveRecord}" />&nbsp;
                    <apex:commandLink value="Del" reRender="table" rendered="{!account.id!=editList}" onclick="if (window.confirm('Are you sure?')) deleteAccount('{!account.Id}');"/>
                    <apex:commandLink value="Cancel" reRender="account_list" rendered="{!account.id==editList}" action="{!cancelRecord}"/>
                <apex:column >
                    <apex:facet name="header">Name</apex:facet>
                    <apex:outputField value="{!account.Name}" rendered="{!account.id!=editList}" />
                    <apex:inputField value="{!account.Name}" rendered="{!account.id==editList}" />
                <apex:column >
                    <apex:facet name="header">Type</apex:facet>
                    <apex:outputField value="{!account.Type}" rendered="{!account.id!=editList}" />
                    <apex:inputField value="{!account.Type}" rendered="{!account.id==editList}" />
                <apex:column >
                    <apex:facet name="header">Description</apex:facet>
                    <apex:outputField value="{!account.Description}" rendered="{!account.id!=editList}" />
                    <apex:inputField value="{!account.Description}" rendered="{!account.id==editList}" />
        <apex:actionFunction action="{!deleteAccount}" name="deleteAccount" reRender="table">
        <apex:param name="accountid" value="" assignTo="{!selectedAccountId}" />

Public class AccountListController{
 Public list<Account> accList{get;set;}
 Public  Id editList{get;set;}
 Public String selectedAccountId{get;set;}
 Public list<Account> duelist{get;set;}
 Public list<Account> CandidateList{get;set;}
 Public AccountListController(ApexPages.StandardController controller){
      accList = new list<Account>();
      accList =[SELECT Id, Name, Type, Description FROM Account];
 Public void saveRecord(){
      Update accList;
      editList = null;
 Public void cancelRecord(){
      editList = null;
 Public void deleteAccount(){
     if(selectedAccountId == Null){
       Account ac=[select id from Account where id =:selectedAccountId];
         Delete Ac;
         editList = null;

Ankur Saini
Martha GriggsMartha Griggs
You can use canvas apps as custom actions to give users access to the functionality of your apps in communities. Configure your canvas app for Lightning Component and Visualforce Page in Canvas App Settings. You can then load the canvas app inside a Visualforce page, Visualforce action, and Lightning components in published communities, if you are interested. Also you can check some mofe information about these processes here (https://mobilunity.com/blog/hire-salesforce-commerce-cloud-demandware-developer-for-your-projects/)