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

Best way to check size of the children/has children node of the responsive grid 'root' node

Avatar

Avatar
Validate 1
Level 2
srikanthg212933
Level 2

Likes

4 likes

Total Posts

37 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Validate 1
Level 2
srikanthg212933
Level 2

Likes

4 likes

Total Posts

37 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back
View profile
srikanthg212933
Level 2

21-05-2020

Hi Community,

 

I am looking for standard/easy way to find the size of the first level children of the root responsive grid node. I understand that we can do it in jave/javascript code with list-children and find the size.

 

Is there any simple way in HTL itself to find that root node has children or not. if possible with size also.

htl javascript

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

440 likes

Total Posts

1,016 posts

Correct Reply

115 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

440 likes

Total Posts

1,016 posts

Correct Reply

115 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

21-05-2020

@srikanthg212933 Below code should give you the number of child nodes in the immediate parent of your current node

<sly data-sly-test="${currentNode.parent.hasNodes}">
Size is - ${currentNode.parent.nodes.size}
</sly>

, assuming your current component is inside the responsive grid node , the above code will get the number of nodes under the responsive grid

 

For eg : In my case I have 7 nodes under the responsive grid 

 
 

resp-grid.JPG

 And the above code outputs me Size is - 7

Answers (0)