0

I've created a lightning component that shows a table of all contentversions related to the record detail page you are on.

However, if upload/add a new file using the "Files" related list, it doesn't update the component I created..

Is there any lightning event I could use to refresh this automatically?

  • Can you provide minimal component code? I would think if you are using lightning:fileUpload and handling onuploadfinished event, you should be able to re-initialize your component to be able to refresh the contents. – Jayant Das Sep 5 '18 at 14:31
  • I'm uploading files using the "Files" related list in Related tab. – rna7 Sep 5 '18 at 14:36
  • Have you tried listening to force:refreshData? – sfdcfox Sep 5 '18 at 15:54
  • @sfdcfox No I haven't. How can I do that? – rna7 Sep 6 '18 at 9:44
0

Your problem is very similar (not exactly same) to one asked in this question. The answer to this is though same.

You cannot utilize any standard component to interact with any of your custom component. In your scenario, you are using the standard "Files" related list, so there's no way capture any event from that to be able to utilize it in your custom component.

The only way I find you may be able to refresh your component with the uploaded file is to keep on "polling" or "refreshing" your component at regular intervals, but this can be an overhead at times.

The other option was, if you had implemented the file upload feature in a custom way using lighting:fileUpload, you could have used the onuploadfinished. With that you could have raised an event with every upload, so that your other component handles that and refreshes the data every time you upload a file.

| improve this answer | |
0

Once you upload the file, you need to refresh the tab by using event="force:refreshView" in cmponent.

<aura:handler event="force:refreshView" action="{!c.RefreshTab}"/> 

In JSController you need to fire this event in order to refresh the tab after your file gets uploaded.

 action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {  
                var result=response.getReturnValue();
                $A.get('e.force:refreshView').fire();

            } 

For more information refer this link: https://developer.salesforce.com/docs/component-library/bundle/force:refreshView/documentation

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.