Adding Columns(parsys) based on number field entries in AEM 6.4
Hi All,
I am trying to create a component which will add number of columns based on the number selected in the numberfield in dialog. For exm - If I add 3 in the number field it should then generate a layout consisting of three columns with three parsys.
Currently I'm trying to read the number field value and add these values in a list in java. This is the snippet:
if (null != columnProperties) {
numberofcolumns = (Integer) columnProperties.get("numberofcolumns", 1); //number entered from the dialog in numberfield
log.info("Number of Columns: " + numberofcolumns);
for (int i = 0; i < numberofcolumns; i++) {
log.info("Inside for loop");
ColumncontainerVO columnItemVO1 = new ColumncontainerVO();
//String col = "autocomplete" + String.valueOf(i + 1);
columnItemVO1.setNumber(i);
log.info("Column Item"+columnItemVO1);
columnList.add(columnItemVO1);
log.info("columnList"+columnList.get(i));
}
log.info("Outside for loop");
}
public List<ColumncontainerVO> getcolumnList() { //list being generated for the entries
return columnList;
}
After this I'm trying to access this list in sightly using the below code:
<div data-sly-test="${wcmmode.edit}" class="col-content" style="color: gray;">Edit Column Container</br></div>
<div data-sly-use.colControl="com.aem.common.components.mysample.Columncontrol" data-sly-unwrap>
<div class="sample-container">
<div class="row class">
<div data-sly-list="${colControl.columnList}" data-sly-unwrap>
<div data-sly-resource="${ @path=item.number, resourceType='foundation/components/parsys'}"></div>
</div>
</div>
</div>
</div>
However, i'm not getting the list value on the page. The above approach has to be done using WCMUsePojo class in java.
Can anyone please provide their insight?
Regards,
Bernadine Soman