You need to sign in to do that
Don't have an account?
Rajat Mahajan 28
Lightning Tab Attributes do not get set from Server side during the page load (via doInit function)
Dear All
I have a requirement where i need to set lightning tab attributes on page load , this somehow does not work when i get these attributes from server side call
Consider this snippet:
<!--
Name : PinUnpin.cmp
Author : Rajat Mahajan
Date : 24th April, 2018
Desc : This component will showcase the pin unpin functionality on account button click
-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="GLOBAL" controller="PinUnpinController">
<!-- Style sheet LDS -->
<ltng:require styles="{!$Resource.SDLS252 + '/styles/salesforce-lightning-design-system.css'}"/>
<!-- Tabset variables -->
<aura:attribute name="tabNameList" type="Map" />
<aura:attribute name="moretabs" type="Aura.Component[]"/>
<aura:attribute name="selTabId" type="String" />
<!-- Default tab variables -->
<aura:attribute name="defaultTabLabel" type="String" default="test"/>
<aura:attribute name="defaultTabID" type="Integer" default="test"/>
<!-- Call the int method -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!-- Lightning Tab set -->
<lightning:tabset aura:id="tabs" variant="scoped" selectedTabId="{!v.selTabId}" >
<div style="display:block">
<lightning:tab aura:id="defaultTabAuraID" label="{!v.defaultTabLabel}" id="{!v.defaultTabID}" >
{!v.body}
</lightning:tab>
</div>
{!v.moretabs}
</lightning:tabset>
</aura:component>
now my doInit here sets the defaultTabLabel and defaultTabID correctly when i set them from JS Controller directly, but whenever i make server side (Apex) calls from the doInit method, the attributes get set on cmp but do not get set in the lightning tab for some reason.
I believe there is something in the rendering lifecycle that is giving me this problem. I tried to use javascript promise functions also, but was of no help
Has anyone else encountered this problem?
Thanks for your help in advance!
I have a requirement where i need to set lightning tab attributes on page load , this somehow does not work when i get these attributes from server side call
Consider this snippet:
<!--
Name : PinUnpin.cmp
Author : Rajat Mahajan
Date : 24th April, 2018
Desc : This component will showcase the pin unpin functionality on account button click
-->
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="GLOBAL" controller="PinUnpinController">
<!-- Style sheet LDS -->
<ltng:require styles="{!$Resource.SDLS252 + '/styles/salesforce-lightning-design-system.css'}"/>
<!-- Tabset variables -->
<aura:attribute name="tabNameList" type="Map" />
<aura:attribute name="moretabs" type="Aura.Component[]"/>
<aura:attribute name="selTabId" type="String" />
<!-- Default tab variables -->
<aura:attribute name="defaultTabLabel" type="String" default="test"/>
<aura:attribute name="defaultTabID" type="Integer" default="test"/>
<!-- Call the int method -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<!-- Lightning Tab set -->
<lightning:tabset aura:id="tabs" variant="scoped" selectedTabId="{!v.selTabId}" >
<div style="display:block">
<lightning:tab aura:id="defaultTabAuraID" label="{!v.defaultTabLabel}" id="{!v.defaultTabID}" >
{!v.body}
</lightning:tab>
</div>
{!v.moretabs}
</lightning:tabset>
</aura:component>
now my doInit here sets the defaultTabLabel and defaultTabID correctly when i set them from JS Controller directly, but whenever i make server side (Apex) calls from the doInit method, the attributes get set on cmp but do not get set in the lightning tab for some reason.
I believe there is something in the rendering lifecycle that is giving me this problem. I tried to use javascript promise functions also, but was of no help
Has anyone else encountered this problem?
Thanks for your help in advance!
sample