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

Access model class outside component HTML

Avatar

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

22-08-2017

Hi All,

Can we access a model class parameters outside the component HTML.

for example,

i want to access sampleModel.class parameters written for sample.html from sample2.html or from parent HTML having sample component as a child.

If no, what will be the workaround to access dialog properties of sample component from its parent component?

Following is the structure and i want to access all properties of all sample components:

parent component

     -jcr:content

          -parsys

               -sample

               -sample_6733100011

Note: properties.<porperty_name> doesnt work.

Replies

Avatar

Avatar
Give Back 10
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

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

Avatar
Give Back 10
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 1
View profile
poojac35931336
Level 3

22-08-2017

As far as I understand, sample and sample_6733100011 are the same component dropped twice in a single  parsys but I am not clear about  where do you want to access the properties of sample component.

Avatar

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

22-08-2017

Hi Pooja,

yes, they both are same component and i want to display one property called "data" as follows:

${properties['parsys/sample/data'] @context='unsafe'}

This works fine for sample component, but in future author may drag and drop as many sample component as they want. and the name will be different for every new sample component dropped under parsys.

So how can i get the values looping over parsys node?

I can do that via sling models, i was wondering if we have any such method in sightly or any scriplet with which i can list all the 'data' property of sample component?

Avatar

Avatar
Give Back 10
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

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

Avatar
Give Back 10
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 1
View profile
poojac35931336
Level 3

22-08-2017

I think every sample component dropped in parsys will have their own data property and sling model will fetch the property of respective component.

Set this values for all the components dropped and null should not come if the property is set for that component as it resolves on the basis current resource only. You can follow this link for your reference

Avatar

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

Avatar
Validate 10
Level 3
khalidMomin
Level 3

Likes

20 likes

Total Posts

78 posts

Correct Reply

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

22-08-2017

Hi Pooja,

You didnt get my question.

the question was about looping over child components of parsys.

i wanted to know a method by which i can loop over child components i.e. all sample components dropped in parsys.

Anyways, i found another solution.

Thanks a lot for your time.