Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Get props in List of List of Object based on Specific Index in Sightly

Avatar

Avatar
Validate 10
Level 2
Bahar
Level 2

Likes

6 likes

Total Posts

32 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Bahar
Level 2

Likes

6 likes

Total Posts

32 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Bahar
Level 2

07-05-2019

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.

View Entire Topic

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

09-05-2019

Are you basing this on a SLING MODEL -where you know your collections are properly set?