function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandeep YadavSandeep Yadav 

$A.get('e.force:refreshView').fire() is not updating my custom data table after editing the record

Here is what i have done.
By clicking on edit button am calling editActionHelper from JS Controller....
editActionHelper : function(component,event,helper){
        var buttonValue = event.getSource().get('v.value');
        var editRecordEvnt = $A.get('e.force:editRecord');
        editRecordEvnt.setParams({
            recordId : buttonValue
        });
        editRecordEvnt.fire();
        $A.get('e.force:refreshView').fire();
    },
Any help regarding this???
 
Raj VakatiRaj Vakati
Your code is correct .. but are you using this code in lightning experince or somewhere else like VF page etc 
Sandeep YadavSandeep Yadav
Hi raj, 
I am using the code in Lightning Experience..

Here is my component code for custom data tale....
<tbody>
            	<aura:iteration items="{!v.contactList}" var="ct">
                	<tr class="slds-hint-parent">
                        <td>
                        	<ui:inputCheckbox aura:id="cboxRow" text="{!ct.Id}" change="{!c.selectAllChange}"/>
                        </td>
                        <td>
                        	<div class="slds-truncate">{!ct.FirstName}</div>
                        </td>
                        <td>
                        	<div class="slds-truncate">{!ct.LastName}</div>
                        </td>
                         <td>
                        	<div class="slds-truncate">{!ct.Email}</div>
                        </td>
                        <td>
                        	<div class="slds-truncate">{!ct.Phone}</div>
                        </td>
                         <td>
                        	<lightning:buttonIcon iconName="utility:edit" variant="bare" onclick="{! c.handleEditAction }" alternativeText="Edit" value="{!ct.Id}"/>
                        </td>
                    </tr>
                </aura:iteration>
            </tbody>

After editing the record i want to refresh contactList  aura attribute.
Raj VakatiRaj Vakati
From where the  contactList List is coming .. You can get the values again from DB and Set It to the attribute 


can u give me complete code .. 

 
Sandeep YadavSandeep Yadav
Hi Raj,
I have already tried this way by setting attribute value with response from server after firing e.force:editRecord event but it doesnot reflect new values.
new values are coming in table after reloading the page.
Here is my controller and helper code.. 
Controller.js

({
	doInit : function(component, event, helper) {
		component.set("v.columns",[
            {label : "First Name", fieldName : "FirstName", type : "text"},
            {label : "Last Name", fieldName : "LastName", type : "text"},
            {label : "Email", fieldName : "Email", type : "email"},
            {label : "Phone", fieldName : "Phone", type : "text"}
        ]);
        helper.fetchDetails(component,event,helper);
	},
    
    handleEditAction : function(component,event,helper){
        console.log('hello edit');
        helper.editActionHelper(component,event,helper) 
        
    }
})


helper.js

({
    fetchDetails : function(component,event,helper){
        var fetchAction = component.get('c.getContactRecords');
        fetchAction.setCallback(this,function(response){
            var state = response.getState();
            if(state === 'SUCCESS'){
                component.set('v.contactList',response.getReturnValue());
            }
        });
        $A.enqueueAction(fetchAction);
    },
	
	editActionHelper : function(component,event,helper){
        console.log('hello edit helper');
        console.log(event.getSource().get('v.value'));
        var buttonValue = event.getSource().get('v.value');
        var editRecordEvnt = $A.get('e.force:editRecord');
        editRecordEvnt.setParams({
            recordId : buttonValue
        });
        editRecordEvnt.fire();
        //helper.reloadContactTable();
        this.fetchDetails(component,event,helper); 
    }
})

beacuse code contains more functionalities so I shared relevant code for edit and refresh approach.

Regards
Sandeep