1

I have a table of records and I need to rerender the table when a record is deleted. The delete function works fine but it doesn't rerender the table.

<apex:pageblock title="Record" id="records_block">
    <apex:pageblocktable value="{!records}" var="record">
        <apex:column>
            <apex:commandButton value="Delete" action="{!deleteRecord}" reRender="records_block">
                <apex:param name="recordId" value="{!record.Id}" assignTo="{!recordId}" />
            </apex:commandButton>
        </apex:column>
        <apex:column value="{!record.Date__c}" />
        <apex:column value="{!record.Type__c}" />
    </apex:pageblocktable>
</apex:pageblock>

public String recordId { get; set {recordId = value;} }
public void deleteRecord() {
    Record__c record = [SELECT Id FROM Record__c WHERE Id=:recordId];
    delete record;
}
1
  • I have answered .If this does not fix ,share your whole code and we will get it fixed Jul 19, 2015 at 15:33

1 Answer 1

2

You would have used get set on your list .The list that renders or displays table still holds the previous values cached and hence you are not getting actual results.

You may like to again re query whole list back and populate your getter for correct result .

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .