function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Adelchi PelizzoAdelchi Pelizzo 

How to to get conditional rendering inside an iterator which is inside a scroller?

<!--            <ui:scrollerWrapper  class="scroll" >-->
    <aura:iteration items="{!v.commentsData}" var="comment" indexVar="key">
        <lightning:card class="{!comment.Color == 'grey' ? 'grey' : 'blue'}" aura:id="{!comment.Color}+{!key}">
            {!comment.text}
        </lightning:card>
    </aura:iteration>
    <!--    </ui:scrollerWrapper>-->
If ui:scrollerWrapper is uncommented, the class in card element does not work.
 
Best Answer chosen by Adelchi Pelizzo
Adelchi PelizzoAdelchi Pelizzo
Sorry for misunderstanding, as I said before, I have been able to debug it. It is about css height and radius values. Radius cannot be = 0 for example.

All Answers

Adelchi PelizzoAdelchi Pelizzo
I added height propertries 100% to css for Lightning:card. then I removed it, and now it works ... mistery?
Alok Singh 140Alok Singh 140
just place 
 rendered="{!if(condition,true,false)}"
attribute to the eliment you want to render on condition
I hope it will work for you,if you need further help tell me about your condition on which condition you want to render it.
 
Adelchi PelizzoAdelchi Pelizzo

It not a conditional rendering, it is conditional class attribution.
Line 3: class="{!comment.Color == 'grey' ? 'grey' : 'blue'}"

So the correct question would be:

How to to get conditional class attribution inside an iterator which is inside a scroller?

 

Alok Singh 140Alok Singh 140
Hi
Adelchi Pelizzo,
use this code in Line 3:
class="{! if(comment.Color == 'grey','grey','blue') }"
Adelchi PelizzoAdelchi Pelizzo
Sorry for misunderstanding, as I said before, I have been able to debug it. It is about css height and radius values. Radius cannot be = 0 for example.
This was selected as the best answer