[SalesForce] Rerender related skuid model/fields on save of related model in table

I've built a Skuid page to edit a parent object and it's children. The parent object is in a field editor component and the child records are in a table component. Edits made to the child objects will affect rollup fields in the parent object. How can I get that model to refresh after clicking the "Save" button for the table component with the children?

I'm new to Skuid, but I can't seem to find any way to wire the save button up on the table component so that it causes the the parent object's section to get refreshed/rerendered. Is this possible without JS? And if JS is require, are there any examples out there for how to accomplish this?

Best Answer

As of the Skuid Spring 14 release, you have to use JavaScript to do this. Coming in the Skuid Summer 14 release, you will be able to use the Skuid "Action Framework" to accomplish this without needing to write JavaScript.

Here's a Skuid Community post that speaks directly to this question:

How do you update display of data from one model when related data in another model changes?

  1. Create a new JavaScript Resource, with location Inline. Resource name can be whatever you want, e.g. "Update Parent Model when Child Model is saved"
  2. For the Resource Body, paste in the following, replacing Album and Tracks with the names of your Parent and Child Models:

    skuid.$(function(){ 
    
        var ParentModel = skuid.model.getModel('Album'), 
            ChildModel = skuid.model.getModel('Tracks'); 
    
        var listener = new skuid.ui.Editor(); 
        listener.handleSave = function() { 
            if (!ParentModel.hasChanged) { 
               ParentModel.updateData(); 
            } 
        }; 
        listener.registerModel(ChildModel); 
    }); 
    

That should do it! For more info, see the docs on the skuid.ui.Editor object.