You need to sign in to do that
Don't have an account?

How to refresh the pagetableblock after clicking commandlink??
I want to have latest values after clicking "Remove interest".. Code is working perfectly but I am able to see only after refreshing on my own
My vf page is:
<apex:page standardController="Aspirant__c" extensions="displayRelatedlists">
<apex:form >
<apex:pageBlock id="blk">
<apex:pageBlockTable value="{!prsns}" var="pr">
<apex:column value="{!pr.Name__c}" />
<apex:column >
<apex:facet name="header">Remove Interest</apex:facet>
<apex:commandLink value="Remove Interest" action="{!removeInterest}" reRender="blk" >
<apex:param assignTo="{!aspId}" name="aspId" value="{!pr.Id}" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
apex class:
public class displayRelatedlists{
public ApexPages.StandardController controller{get;set;}
public Aspirant__c asps{get;set;}
public List<Interested_Persons__c> prsns{get;set;}
public String aspId{get;set;}
public displayRelatedlists(ApexPages.StandardController controller)
{
this.controller = controller;
this.asps= (Aspirant__c)controller.getRecord();
this.prsns = [SELECT Name__c from Interested_Persons__c where Interested_To__c=:asps.Id];
}
public PageReference removeInterest()
{
system.debug('++++++++++++++++++++ '+aspId);
Interested_Persons__c ipc = [select Id,Name__c from Interested_Persons__c where Id=:aspId];
delete ipc;
return null;
}
}
My vf page is:
<apex:page standardController="Aspirant__c" extensions="displayRelatedlists">
<apex:form >
<apex:pageBlock id="blk">
<apex:pageBlockTable value="{!prsns}" var="pr">
<apex:column value="{!pr.Name__c}" />
<apex:column >
<apex:facet name="header">Remove Interest</apex:facet>
<apex:commandLink value="Remove Interest" action="{!removeInterest}" reRender="blk" >
<apex:param assignTo="{!aspId}" name="aspId" value="{!pr.Id}" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
apex class:
public class displayRelatedlists{
public ApexPages.StandardController controller{get;set;}
public Aspirant__c asps{get;set;}
public List<Interested_Persons__c> prsns{get;set;}
public String aspId{get;set;}
public displayRelatedlists(ApexPages.StandardController controller)
{
this.controller = controller;
this.asps= (Aspirant__c)controller.getRecord();
this.prsns = [SELECT Name__c from Interested_Persons__c where Interested_To__c=:asps.Id];
}
public PageReference removeInterest()
{
system.debug('++++++++++++++++++++ '+aspId);
Interested_Persons__c ipc = [select Id,Name__c from Interested_Persons__c where Id=:aspId];
delete ipc;
return null;
}
}
and the remove link is just removing a single interested person from the list..
so instead of clearing the entire list, if you reload your collection after deleting the single record, it should get updated in the table as well..
All Answers
and the remove link is just removing a single interested person from the list..
so instead of clearing the entire list, if you reload your collection after deleting the single record, it should get updated in the table as well..