Hi All,
I have searched how to get child resource from "resource" object in sightly, but haven`t found any answer.
I know that I could read property of child node, but I include parsys in my component and want to list children of parsys.
As a workaround I do
<div data-sly-list.parsys="${resource.listChildren}" data-sly-unwrap> <ul data-sly-list.item="${parsys.listChildren}"> ... process item ... </ul> </div>
how to have sth like:
${resource.parsys.listChildren}
Thanks for your help :)
Solved! Go to Solution.
There are the following methods on the Resource object:
getChild(String)
getChildren() / listChildren()
Currently sightly does not support calling a method with an argument.
If you want to do this, you need to use the use-api for this.
This is covered in docs:
http://docs.adobe.com/docs/en/aem/6-0/develop/sightly.html
See:
< dl data-sly-list.child = "${currentPage.listChildren}" > < dt >index: ${childList.index}</ dt > < dd >value: ${child.title}</ dd > </ dl >
|
Views
Replies
Total Likes
There are the following methods on the Resource object:
getChild(String)
getChildren() / listChildren()
Currently sightly does not support calling a method with an argument.
If you want to do this, you need to use the use-api for this.
Thanks for the clarification, I would go with additional Sling Model for it.
Views
Replies
Total Likes
This might work in this case:
<sly data-sly-use.parsys="${resource.path}/parsys" data-sly-list="${parsys.listChildren}">
<pre>${item.name}</pre>
</sly>
We can work with resources with data-sly-use.
Good Luck...
how to get children by using node object
Views
Replies
Total Likes
nodeObject.listChidlren
Views
Replies
Total Likes