Skip to main content
deleted 42 characters in body; edited tags
Source Link
cloudZigZag
  • 1.4k
  • 3
  • 31
  • 81

row not delete when click on delete hyperlink what i'm doing wrong.

apex class

public class ActionFunctionDeleteEditControllerDeleteEditController{
public List<Stud__c> contacts{get;set;}
public String conId{get;set;}

public ActionFunctionDeleteEditControllerDeleteEditController(){
    contacts = new List<Stud__c>([Select Id, Name__c, Email_Address__c from Stud__c]);
    
}

public PageReference remove(){
    integer index = 0;
    for(Stud__c con : contacts){
        if(con.Id == conId){
            contacts.remove(index);
            break;
        }
        index ++ ;
    }
    return null;
  }
}

VFPAge

<apex:page controller="ActionFunctionDeleteEditController">controller="DeleteEditController">
<apex:form >
        <apex:actionFunction name="Remove" action="{!remove}" rendered="rm">
       <apex:param name="arg" value="" assignTo="{!conId}"/>
       </apex:actionFunction>
         <apex:pageBlock id="rm">
        <apex:pageblockTable value="{!contacts}" var="co">
          <apex:column headerValue="Delete Record">
          <a href="#" onClick="remove('{!co.Id}');">Delete</a></apex:column>
         <apex:column value="{!co.Name__c}"/>
         <apex:column value="{!co.Email_Address__c}"/> 
        </apex:pageblockTable>
    </apex:pageBlock>
</apex:form>

</apex:page>

row not delete when click on delete hyperlink what i'm doing wrong.

apex class

public class ActionFunctionDeleteEditController{
public List<Stud__c> contacts{get;set;}
public String conId{get;set;}

public ActionFunctionDeleteEditController(){
    contacts = new List<Stud__c>([Select Id, Name__c, Email_Address__c from Stud__c]);
    
}

public PageReference remove(){
    integer index = 0;
    for(Stud__c con : contacts){
        if(con.Id == conId){
            contacts.remove(index);
            break;
        }
        index ++ ;
    }
    return null;
  }
}

VFPAge

<apex:page controller="ActionFunctionDeleteEditController">
<apex:form >
        <apex:actionFunction name="Remove" action="{!remove}" rendered="rm">
       <apex:param name="arg" value="" assignTo="{!conId}"/>
       </apex:actionFunction>
         <apex:pageBlock id="rm">
        <apex:pageblockTable value="{!contacts}" var="co">
          <apex:column headerValue="Delete Record">
          <a href="#" onClick="remove('{!co.Id}');">Delete</a></apex:column>
         <apex:column value="{!co.Name__c}"/>
         <apex:column value="{!co.Email_Address__c}"/> 
        </apex:pageblockTable>
    </apex:pageBlock>
</apex:form>

</apex:page>

row not delete when click on delete hyperlink what i'm doing wrong.

apex class

public class DeleteEditController{
public List<Stud__c> contacts{get;set;}
public String conId{get;set;}

public DeleteEditController(){
    contacts = new List<Stud__c>([Select Id, Name__c, Email_Address__c from Stud__c]);
    
}

public PageReference remove(){
    integer index = 0;
    for(Stud__c con : contacts){
        if(con.Id == conId){
            contacts.remove(index);
            break;
        }
        index ++ ;
    }
    return null;
  }
}

VFPAge

<apex:page controller="DeleteEditController">
<apex:form >
        <apex:actionFunction name="Remove" action="{!remove}" rendered="rm">
       <apex:param name="arg" value="" assignTo="{!conId}"/>
       </apex:actionFunction>
         <apex:pageBlock id="rm">
        <apex:pageblockTable value="{!contacts}" var="co">
          <apex:column headerValue="Delete Record">
          <a href="#" onClick="remove('{!co.Id}');">Delete</a></apex:column>
         <apex:column value="{!co.Name__c}"/>
         <apex:column value="{!co.Email_Address__c}"/> 
        </apex:pageblockTable>
    </apex:pageBlock>
</apex:form>

</apex:page>

edited tags
Link
Martin Lezer
  • 7.3k
  • 5
  • 27
  • 41
Source Link
cloudZigZag
  • 1.4k
  • 3
  • 31
  • 81

delete row when click on hyperlink of delete

row not delete when click on delete hyperlink what i'm doing wrong.

apex class

public class ActionFunctionDeleteEditController{
public List<Stud__c> contacts{get;set;}
public String conId{get;set;}

public ActionFunctionDeleteEditController(){
    contacts = new List<Stud__c>([Select Id, Name__c, Email_Address__c from Stud__c]);
    
}

public PageReference remove(){
    integer index = 0;
    for(Stud__c con : contacts){
        if(con.Id == conId){
            contacts.remove(index);
            break;
        }
        index ++ ;
    }
    return null;
  }
}

VFPAge

<apex:page controller="ActionFunctionDeleteEditController">
<apex:form >
        <apex:actionFunction name="Remove" action="{!remove}" rendered="rm">
       <apex:param name="arg" value="" assignTo="{!conId}"/>
       </apex:actionFunction>
         <apex:pageBlock id="rm">
        <apex:pageblockTable value="{!contacts}" var="co">
          <apex:column headerValue="Delete Record">
          <a href="#" onClick="remove('{!co.Id}');">Delete</a></apex:column>
         <apex:column value="{!co.Name__c}"/>
         <apex:column value="{!co.Email_Address__c}"/> 
        </apex:pageblockTable>
    </apex:pageBlock>
</apex:form>

</apex:page>