You need to sign in to do that
Don't have an account?
Hi,I wanted to excute inner <aura:if> only once.I'm unable to set the attribute value to false.Help is appreciated.
<aura:attribute name="native" type="boolean" default="true"/>
<aura:attribute name="accounts" type="Account[]"/>
<div class="pink">
<table style="width:100%">
<aura:iteration var="acc" items="{!v.accounts}">
<aura:if isTrue="{!acc.Id != ' '}">
<aura:if isTrue="{!v.native}">
<tr>
<th>Account Id</th>
<th>Name</th>
<th>Country</th>
<th>City</th>
<th>Email</th>
</tr>
{!v.native}=false;
component.set("v.native",'false');
{!v.native};
</aura:if>
<tr>
<td>{!acc.Id} </td>
<td>{!acc.Name} </td>
<td>{!acc.Country__c} </td>
<td> {!acc.City__c} </td>
<td>{!acc.Email__c}</td>
</tr>
</aura:if>
</aura:iteration>
</table>
</div>
I wanted to set "native" attribute to false without using the client controller.If anyone having another solution to this problem.
Please share it.
<aura:attribute name="accounts" type="Account[]"/>
<div class="pink">
<table style="width:100%">
<aura:iteration var="acc" items="{!v.accounts}">
<aura:if isTrue="{!acc.Id != ' '}">
<aura:if isTrue="{!v.native}">
<tr>
<th>Account Id</th>
<th>Name</th>
<th>Country</th>
<th>City</th>
<th>Email</th>
</tr>
{!v.native}=false;
component.set("v.native",'false');
{!v.native};
</aura:if>
<tr>
<td>{!acc.Id} </td>
<td>{!acc.Name} </td>
<td>{!acc.Country__c} </td>
<td> {!acc.City__c} </td>
<td>{!acc.Email__c}</td>
</tr>
</aura:if>
</aura:iteration>
</table>
</div>
I wanted to set "native" attribute to false without using the client controller.If anyone having another solution to this problem.
Please share it.
Can you please try to change 'false' to false if the native is not string type ?
Please let me know the result.
Reagrds,
BDatla
I wanted to view <th> (table header) only once.
You are doing mistake in your code in this line ,
{!v.native}=false;
component.set("v.native",'false');
your both of above line won't work inside component directly.
In .cmp file only HTMl, and expression will work but u can't use this method inside the .cmp file.
if you want to change the value of your attribute u need to do this using controller , define an event call the javascript code and change the value of your attribute.
For your query of getting header element only once i did this coding : And my below screenshot is the result.
i have not added much CSS but u can do .
If your problem solve please close this thread by clicking on best answer.
If you have any further doubt on this then please let me know.
Thanks
Rishav Kumar
I really appreciate your help.But i want to change the value of attribute on the .cmp file itself without using the client controller .
Anything else do you want to suggest?
I don't know anything beyond this, so can't suggest you
Please update the code as below it is working for me.
Let me know if you still have any problems with this.
If your problem solve please close this thread by clicking on best answer.
Thanks,
Ramesh
LinkedIn: https://www.linkedin.com/in/kallooriramesh/