I have requirement to add numbers present in list and if count is greater than 12 i need to add extra div i html.I am able to do this in jsp.But how can be acheive this in sightly.if i write count logic in java how can i add the extra div in html
Below is code in jsp
<c:forEach items="${colValues}" var="colValue">
<c:set var="lgHidden" value=''/>
<c:set var="mdHidden" value=''/>
<c:set var="smHidden" value=''/>
<c:set var="xsHidden" value=''/>
<fmt:parseNumber var="lgValue" type="number" value="${colValue['large']}" />
<fmt:parseNumber var="lgCount" type="number" value="${lgValue+lgCount}" />
<c:if test="${lgCount>12}">
<fmt:parseNumber var="lgCount" type="number" value="${lgValue}" />
<div class="clearfix visible-lg-block"></div>
</c:if>
The above coddee is fine in jsp.But how to add two variables in sightly
As per the spec Sightly does not support operations inside expressions. You would need to create a helper use-object (using either JavaScript or Java) that would provide the test threshold/reference value.