• #32694
    Forcetalks

    Render and Rerender in lightning in salesforce.

    How to use render and rerender in lightning component?

    #32695
    Forcetalks

    Hello Shradha,

    Rendered:

    This to rendered(ie., display) particular filed or section based on boolean value.  In the controller you need to have get method to assign the value for this variable.

    Eg:

    <apex:inputField value=”{obj.Filed_C}”  Rendered=”{!val == true}”/>

    controller:

    public boolean val{get;set;}

    method(){
    val = true;
    }

    ReRender:

    This is to ReReder(ie.,Reload) some fields, or sections  after some operation/change. For this you need to assign id to field, sections.

    Eg:

    <apex:actionRegion >
    <apex:inputField value=”{!test}”  >
    <apex:actionSupport event=”onchange” rerender=”yrs,yrss,yrsss,nodays,nohours,nominutes” action=”{!test}” >
    <apex:param name=”Para” value=”{!rowNum}” assignTo=”{!IndexValue}” />
    </apex:actionSupport>
    </apex:inputField>
    </apex:actionRegion>
    </apex:inputField>

    #32699
     Anjali #8
    Forcetalks

    Render in lightning:To override the base render()function after component initialization,You need to call superRender()function.It returns value (DOM or NULL).Anything needs to be changed during default rendering.

    render : function(component, helper) {
    var ret = this.superRender();
    // custom rendering logic here
    return ret;
    }

    Rerender in lightning:This is triggered due to anything change to the components.Need to call superRerender()function.Generally, it does not return a value.It is triggered if anything is changed to the components just like button disable after clicked the button to show some results.

    rerender : function(component, helper){
    this.superRerender();
    // custom rerendering logic here
    }

    #35170
    Salesforce | shariq shariq #1
    Forcetalks

    Hi,

    Create a Custom Renderer
    The framework’s rendering service takes in-memory component state and creates and manages the DOM elements owned by the component. If you want to modify DOM elements created by the framework for a component, you can modify the DOM elements in the component’s renderer. Otherwise, the framework will override your changes when the component is rerendered.
    The DOM is the language-independent model for representing and interacting with objects in HTML and XML documents. The framework automatically renders your components so you don’t have to know anything more about rendering unless you need to customize the default rendering behavior for a component.

    Base Component Rendering
    The base component in the framework is aura:component. Every component extends this base component.

    The renderer for aura:component is in componentRenderer.js. This renderer has base implementations for the four phases of the rendering and rerendering cycles:

    render()
    rerender()
    afterRender()
    unrender()
    The framework calls these functions as part of the rendering and rerendering lifecycles and we will learn more about them soon. You can override the base rendering functions in a custom renderer.

    Hope this helps.

    #39521
    Salesforce | Parul Parul #2
    Forcetalks

    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.
    }

    #41779
    Forcetalks

    hi,

    render

    render : function(component, helper) {
    var ret = this.superRender();
    // custom rendering logic here
    return ret;}

    rerender

    rerender : function(component, helper){
    this.superRerender();
    // custom rerendering logic here
    }

Viewing 6 posts - 1 through 6 (of 6 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?