3

I've got a page that has a search box; selecting a result sets {v.id}

Underneath all that, I've got these two outputs:

<force:recordView recordID="{!v.id}" type="MINI"/>

<ui:inputText value="{!v.id}"/>

When {!v.id} gets changed, the force:recordView doesn't update, but the inputText does. How do you make the recordView re-render?

I've tried wrapping in an aura:if to see if that would trigger it. Also, this is being used outside sf1, if that matters.

1 Answer 1

10

As of Summer '15 this component still has server-side dependencies that prevent it from updating as desired. You will need create the component in JavaScript to achieve the desired result. Here's a small app that demonstrates this:

<aura:application access="GLOBAL">
    <aura:attribute name="id" type="String" access="GLOBAL" default="001B0000003jUXI"/>
    <aura:handler name="change" value="{!v.id}" action="{!c.updateRecordView}"/>
    <div aura:id="container">
        <force:recordView recordID="{!v.id}" type="MINI"/>
    </div>
    <ui:inputText value="{!v.id}"/>
</aura:application>

And the controller code:

({
    updateRecordView: function(component, event, helper) {
        var id = component.get("v.id");
        var container = component.find("container");
        $A.createComponent("force:recordView",
                           {recordId: id,type: "MINI"},
                           function(cmp) {
                               container.set("v.body", [cmp]);
                           });
    }
})

Hope this helps!

1
  • 1
    Thanks, Skip. Do we have any way to document which components support auto-rerendering, just to save people time? Commented Jul 7, 2015 at 23:40

You must log in to answer this question.

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