Hello All,
I have a list which I call rows here, then inside that I have another list which is list itself, but I want to get specific index of that list based on outer list index.(rowsList.index), after that I will get the objects inside inner list to show props.
But it is not going inside <sly data-sly-list.singleList="${logic.listOLists[rowsList.index]}">
I have these two list in my service:
public ArrayList<ArrayList<List<MyObject>>> listOfLists = new ArrayList<ArrayList<List<MyObject>>>();
public ArrayList<List<MyObject>> singleList = new ArrayList<List<MyObject>>();
each item of singleList is like this:
public List<MyObject> myObject = new ArrayList<>();
How should I get inside that listOfLists based on index of outter list?
What is exactly method I need to make sure it will get name/label/required from myobject?
I know that service is adding correctly to the "listOfLists" and "singleList".
Here is part of my sightly.
<div data-sly-use.logic="xx.xx.model.searchRows">
<table>
<sly data-sly-list.rows="${logic.selectedRows}">
<tr>
<td>
<input type="text" id="name" name="name" value=${rows.name}>
</td>
<td>
<sly data-sly-list.singleList="${logic.listOfLists[rowsList.index]}">
<sly data-sly-list.innerList="${singleList.listChildren}">
<h2>${innerList.name} - ${innerList.label} - ${innerList.href}</h2>
</sly>
</sly>
</td>
</tr>
</sly>
</table>
</div>
Thanks for your time.
Solved! Go to Solution.
Views
Replies
Total Likes
Are you basing this on a SLING MODEL -where you know your collections are properly set?
Views
Replies
Total Likes
In sightly I have created another template and pass parameter to the next template.
Still no luck to get list of list based on index which is passing correctly!
<sly data-sly-test.listOfLists="${logic.listOfLists}">
<div data-sly-use.infoTemplate="info.html">
<sly data-sly-call="${infoTemplate.renderInfo @
logic=logic, i=rowsList.index, listOfLists=listOfLists}" />
</div>
</sly>
==========================
<template data-sly-template.renderInfo="${ @ logic, i, listOfLists}">
<sly data-sly-test="${listOfLists.size > 0 && i < listOfLists.size}"> ====> It is passing this line
<sly data-sly-test.singleList="${listOfLists[i]}"> ======> This one doesn't pass!!
.........
</sly>
</template>
Any Idea why listOfLists[i] is not returning singleList?!
Views
Replies
Total Likes
Are you basing this on a SLING MODEL -where you know your collections are properly set?
Views
Replies
Total Likes
Yes, I know the property has been set correctly. In service I have while loop with these:
singleList.add(this.Info1);
singleList.add(this.Info2);
singleList.add(this.Info3);
singleList.add(this.Info4);
listOfLists.add(singleList);
And they have set values which I can see in the logs/debugger & size of each list are same as my db correctly.
My only problem is why I can't get listofLists[i] here!
Views
Replies
Total Likes
I have done some changes in my model and add id manually, and I guess I am close to get my result. At least I could get the list based on index. thank you.
Views
Replies
Total Likes
Views
Likes
Replies