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

Child node path in javascript

Avatar

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
varuns46785756
Level 4

16-03-2017

Hi,

I have images in dam in particular path.  like: content/dam/myproject/stateimage/image1.jpg....content/dam/myproject/stateimage/image2.jpg....

I am getting path through page property upto: content/dam/myproject/stateimage.

I am trying to iterate all the images path under this location(content/dam/myproject/stateimage.) in my component in javascript( serevr side script).Please suggest

 

 

Regards

Replies

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

16-03-2017

If you want to use script to iterate through DAM Assets - much better to use JSP than JS. 

See" 

https://helpx.adobe.com/experience-manager/using/aem-dam-image-components.html

Why are you using JS to try and read JCR nodes? 

Avatar

Avatar
Validate 1
MVP
Runal_Trivedi
MVP

Likes

45 likes

Total Posts

153 posts

Correct Reply

68 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
MVP
Runal_Trivedi
MVP

Likes

45 likes

Total Posts

153 posts

Correct Reply

68 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
Runal_Trivedi
MVP

17-03-2017

you should either have your JSP write the child assets in that folder as data attribute and you can use it then in your JS as needed.

OR

You can write a servlet to return all the child asset paths under your folder, make the Ajax call from JS to the servlet and use the response array as you want.

I will suggest you to take the servlet route, as with JSP once your page gets cached, then you won't be able to get the updated list of assets on any new addition of that asset under that dam folder.

~ Runal

Avatar

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
varuns46785756
Level 4

17-03-2017

Hi

smacdonald2008 wrote...

If you want to use script to iterate through DAM Assets - much better to use JSP than JS. 

See" 

https://helpx.adobe.com/experience-manager/using/aem-dam-image-components.html

Why are you using JS to try and read JCR nodes? 

 

Hi Scott,

 

I am using slightly

My requirement is:  . I have one hero image component and : I am displaying different images on each page load and all the images present in dam.

I have asset folder name same as page name in dam.I am getting page path and trying to append the image in page path: like:

 page path :/content/myproject/mypage.html

dam path: /content/dam/myproject/mypage/myimage1.jpg,/content/dam/myproject/mypage/myimage2.jpg

trying to get the image path by server side script.

Regards,

Avatar

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
varuns46785756
Level 4

22-03-2017

Hi,

Please suggest.

 

 

Regards,

Avatar

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct Reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile

Avatar
Give Back 50
Employee
Feike_Visser1
Employee

Likes

247 likes

Total Posts

970 posts

Correct Reply

221 solutions
Top badges earned
Give Back 50
Give Back 5
Give Back 3
Give Back 25
Give Back 10
View profile
Feike_Visser1
Employee

22-03-2017

Are the image-paths stored on the hero-image component?

Avatar

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
varuns46785756
Level 4

Likes

22 likes

Total Posts

146 posts

Correct Reply

2 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
varuns46785756
Level 4

22-03-2017

All images stored in dam , at: dam path: /content/dam/myproject/mypage

images  dam path: /content/dam/myproject/mypage/myimage1.jpg,

                                     /content/dam/myproject/mypage/myimage2.jpg

 I need to iterate all images from this location  /content/dam/myproject/mypage to my component

 

 

Regards,