Activity Forums Salesforce® Discussions How can we re-render a list inside a custom object in Salesforce Lightning Component?

  • Kumar

    Member
    January 16, 2017 at 7:08 am

    Hi Sushant,

    For re-rendering a list in lightning, you just need to use component.set to set the value of the list attributes with updated values (which you obtain from a client side APEX controller maybe?).

    Example:

    This is your attribute:

    <aura:attribute name="expenses" type="Expense__c[]"/>

    So in your JS controller, you do something like:

    var expenses = component.get("v.expenses");
    expenses.push(response.getReturnValue());
    component.set("v.expenses", expenses);

    where the response is coming from the client-side controller.

    Hope this helps.

  • Parul

    Member
    September 28, 2018 at 5:43 pm

    rerender():
    It allows the component to update themselves, when other component updates since they were last rendered. It doesn’t return any value. It automatically called when data is updated in the component. Call superRerender() to chain rerendering to the components in body attribute.
    Example:

    rerender : function(component, helper) {
    this.superRerender();
    // Write your custom code here.
    }

    Hope this helps!

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos