Search code examples
javascriptjqueryhtmlsitebricks

Display hyperlink in <td> based on condition in google sitebricks


I am using Google Sitebricks for developing a user interface.

I have a table which i am displaying using @repeat annotation

@Repeat(items=regusers, var="reguser")

<tr>
<td><a href="/something/${reguser.userId}">${reguser.userId}</a></td>
<td>${reguser.userRegAt}</td>      
</tr>

I have a 'status' variable .based on this value i wanna toggle display of anchor tag in first column

can you please point me to a solution .

Thanks . .


Solution

  • Please try the following

    <tr>
    
    @ShowIf(status)
    <td><a href="/something/${reguser.userId}">${reguser.userId}</a></td>
    
    <td>${reguser.userRegAt}</td>
    </tr>