+ Start a Discussion
Tapasvini MakvanaTapasvini Makvana 

Aura:renderIf condition Issue

Hi,
I have one problem in aura:renderIf condition in iteration component.
I have one requirement in which i have two aura:iteration loops like following

<aura:iteration items={!v.cntlst} var='val'>
         <aura:iteration items={!v.stalst} var='n'>
                 <aura:renderIf isTrue='{! val == n.flval}'>
                             //components to show
                 </aura:renderIf>
         </aura:iteration>
</aura:iteration>

But it is not showing anything even it matches the condition. I think the isTrue condition is not written proper.
Please help me to correct this condition.
Thanks in advance.
Best Answer chosen by Tapasvini Makvana
alsinan nazimalsinan nazim
Hi Tapasvini,

As you have two iterations, Try using <aura:if> inside the second iteration.
 
<aura:iteration items={!v.cntlst} var='val'>
         <aura:iteration items={!v.stalst} var='n'>
<aura:if isTrue="{! val == n.flval}'">
   //components to show
</aura:if>
         </aura:iteration>
</aura:iteration>
Hope that helps
Regards
Alsinan
      

All Answers

Tapasvini MakvanaTapasvini Makvana
I have shared the code piyush. My requirement is that of cntlst value match with the stalst's field value then i need to show some components.
but m not clear how to write this condition.
alsinan nazimalsinan nazim
Hi Tapasvini,

As you have two iterations, Try using <aura:if> inside the second iteration.
 
<aura:iteration items={!v.cntlst} var='val'>
         <aura:iteration items={!v.stalst} var='n'>
<aura:if isTrue="{! val == n.flval}'">
   //components to show
</aura:if>
         </aura:iteration>
</aura:iteration>
Hope that helps
Regards
Alsinan
      
This was selected as the best answer
Tapasvini MakvanaTapasvini Makvana
cntlst is strng[] and stalst is state__c[].
Tapasvini MakvanaTapasvini Makvana
state__c is a custom object and i have to match the name field of this object to cntlst array elements.
sfdcMonkey.comsfdcMonkey.com
try this once
<aura:iteration items={!v.cntlst} var='val'>
        <aura:iteration items={!v.stalst} var='n'>
           <aura:if isTrue="{! val == n.Name}'">
        testing text
           </aura:if>      
   </aura:iteration>
</aura:iteration>

Thanks
 
Tapasvini MakvanaTapasvini Makvana
Hi alsinan nazim,
Thanks for the solution.It worked.
alsinan nazimalsinan nazim
Always Welcome