• bapureddy yalla
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Apex page:

<apex:page controller="DataTableEditRemoveController"  tabStyle="Candidate__c">
<apex:form id="form" >
<apex:pageBlock title="Candidates">
  <apex:pageMessages ></apex:pageMessages>
  <apex:pageBlockTable value="{!accs}" var="row">
     <apex:column >
     
       <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
       <a href="javascript:if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');" style="font-weight:bold">Del</a>&nbsp;|&nbsp;
       <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Update</apex:outputLink>&nbsp;|&nbsp;
     </apex:column>
     <apex:column value="{!row.Name}"/>
     <apex:column value="{!row.Department__c}"/>
     <apex:column value="{!row.DOB__c}"/>
     <apex:column value="{!row.Experience_Years__c}"/>
     <apex:column value="{!row.First_Name__c}"/>
        <apex:column value="{!row.Gender__c}"/>
     
  </apex:pageBlockTable>
</apex:pageBlock>

<apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" >
   <apex:param name="accountid" value="" assignTo="{!SelectedAccountId}"/>
</apex:actionFunction>
</apex:form>
</apex:page>


Controller:


public class DataTableEditRemoveController {

   public List<Candidate__c> accs { get; set; }
  
   //used to get a hold of the account record selected for deletion
   public string SelectedAccountId { get; set; }
  
   public DataTableEditRemoveController() {
       //load account data into our DataTable
       LoadData();
   }
  
   private void LoadData() {
       accs = [Select id, name,Department__c, DOB__c, Experience_Years__c,  First_Name__c,  Gender__c from Candidate__c limit 20];
   }
  
   public void DeleteAccount()
   {
      // if for any reason we are missing the reference 
      if (SelectedAccountId == null) {
      
         return;
      }
     
      // find the account record within the collection
      Candidate__c tobeDeleted = null;
      for(Candidate__c a : accs)
       if (a.Id == SelectedAccountId) {
          tobeDeleted = a;
          break;
       }
      
      //if account record found delete it
      if (tobeDeleted != null) {
       Delete tobeDeleted;
      }
     
      //refresh the data
      LoadData();
   }    
  
  
}
Looking for someone with Salesforce developer skills who would like to work on a client portal project with our nonprofit.  We are in the exploratory stages of this project, and you would have a lot of flexibility and say in defining the project  - Especially interested in volunteers who would like to gain experience, with the possiblity of employment/contract work. 
Respond here or just email your resume and letter of intent to opportunities(at)amhomelife(dot)org  Subject line: SF Portal Developer