You need to sign in to do that
Don't have an account?
how to refresh after delete the record from table in vf page
Hello team,
after delete the record table in not refresh please help me regarding this.
below is my vf code
===================
<div class="slds-col" style="margin-top:10px;">
<p style="font-weight:600; padding:10px;">Distributor / Retailer List</p>
</div>
</div>
<div style="border:1px solid #ccc; margin-top:0px;" class="slds-scrollable_x" >
<apex:outputPanel id="TablePanel">
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered slds-table_striped">
<thead>
<tr class="slds-line-height_reset">
<th class="" scope="col">
<div class="slds-truncate" title="">Account Name</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">SF Customer Code</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">SAP Customer Code</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">Action</div>
</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!membs}" var="awl" >
<tr class="slds-hint-parent">
<th scope="row">
<div class="slds-form-element__control">{!awl.Account__r.Name}</div>
</th>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!awl.Account__r.SF_Customer_Code__c}</div>
</td>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!awl.Account__r.SAP_Customer_Code__c}</div>
</td>
<td data-label="">
<apex:commandLink styleClass="slds-button slds-button_destructive" value="Delete" action="{!showassigndel}" reRender="TablePanel" onclick="if(!confirm('Are you sure?')) return false;" >
<apex:param name="schemeId" value="{!awl.id}" assignTo="{!showdelId}"/>
</apex:commandLink>
</td>
</tr>
</apex:repeat>
</tbody>
<tbody>
<apex:repeat value="{!searchList }" var="swl" >
<tr class="slds-hint-parent">
<th scope="row">
<div class="slds-form-element__control">{!swl.Account__r.Name}</div>
</th>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!swl.Account__r.SF_Customer_Code__c}</div>
</td>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!swl.Account__r.SAP_Customer_Code__c}</div>
</td>
<td data-label="">
<apex:commandLink styleClass="slds-button slds-button_destructive" value="Delete" action="{!Remove}" reRender="TablePanel">
<apex:param name="schemeIdParam" value="{!swl.id}" assignTo="{!delId}"/>
</apex:commandLink>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:outputPanel>
</div>
after delete the record table in not refresh please help me regarding this.
below is my vf code
===================
<div class="slds-col" style="margin-top:10px;">
<p style="font-weight:600; padding:10px;">Distributor / Retailer List</p>
</div>
</div>
<div style="border:1px solid #ccc; margin-top:0px;" class="slds-scrollable_x" >
<apex:outputPanel id="TablePanel">
<table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_col-bordered slds-table_striped">
<thead>
<tr class="slds-line-height_reset">
<th class="" scope="col">
<div class="slds-truncate" title="">Account Name</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">SF Customer Code</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">SAP Customer Code</div>
</th>
<th class="" scope="col">
<div class="slds-truncate" title="">Action</div>
</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!membs}" var="awl" >
<tr class="slds-hint-parent">
<th scope="row">
<div class="slds-form-element__control">{!awl.Account__r.Name}</div>
</th>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!awl.Account__r.SF_Customer_Code__c}</div>
</td>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!awl.Account__r.SAP_Customer_Code__c}</div>
</td>
<td data-label="">
<apex:commandLink styleClass="slds-button slds-button_destructive" value="Delete" action="{!showassigndel}" reRender="TablePanel" onclick="if(!confirm('Are you sure?')) return false;" >
<apex:param name="schemeId" value="{!awl.id}" assignTo="{!showdelId}"/>
</apex:commandLink>
</td>
</tr>
</apex:repeat>
</tbody>
<tbody>
<apex:repeat value="{!searchList }" var="swl" >
<tr class="slds-hint-parent">
<th scope="row">
<div class="slds-form-element__control">{!swl.Account__r.Name}</div>
</th>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!swl.Account__r.SF_Customer_Code__c}</div>
</td>
<td data-label="" class="fromvalue">
<div class="slds-form-element__control">{!swl.Account__r.SAP_Customer_Code__c}</div>
</td>
<td data-label="">
<apex:commandLink styleClass="slds-button slds-button_destructive" value="Delete" action="{!Remove}" reRender="TablePanel">
<apex:param name="schemeIdParam" value="{!swl.id}" assignTo="{!delId}"/>
</apex:commandLink>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:outputPanel>
</div>
Greetings!
YOu can achieve this using the pageRefresh refreshTable() to refresh the page after deletion.Please find the sample code in the below thread:
https://developer.salesforce.com/forums/?id=906F000000098UkIAI
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
find below code-
public PageReference Remove(){
System.debug('delId'+delId);
Scheme_Assign_Master__c delacc=[select id from Scheme_Assign_Master__c where id =:delId limit 1];
System.debug('delacc'+delacc);
if(delacc !=null){
try{
delete delacc;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,' Remove Scheme to Distributor / Retailer Successfully.'));
} catch(DmlException e){
ApexPages.addMessages(e);
}
}else{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Scheme Assign Master not found !'));
}
return null;
}