Expand my Community achievements bar.

SOLVED

Populate Page Properties Data to Component Dialog

Avatar

Level 2

We have Book Template with custom Book Page Component having properties name, description & author etc. We want to auto-populate the data from page properties to Custom Book Component Dialog.

 

Any suggestion how we can achieve this?

 

@aanchal-sikka @EstebanBustamante 

@arunpatidar @Shashi_Mulugu 

@lukasz-m @Mahedi_Sabuj 

 
 
 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @S__k__Agarwal 
Teaser is the correct example.

1. you make a ajax call to page and get the information and populate in a dialog on dialog load event. make sure you disabled this fields otherwise data will be stored in jcr

2. When you do the rendering, render this data from page properties.

 

If you want to populate the value just to prefill before authoring, then you don't need to make disabled and read from the component.



Arun Patidar

View solution in original post

7 Replies

Avatar

Community Advisor

@S__k__Agarwal 

 

- You have a template Book Template.

- It uses Book Page Component 

 

Now, if the page is created from "Book Template" template, its sling:resourceType should be "Book Page Component"

 

In dialog of this component, you would have configured name, description & author. The properties would be accessible via Page properties UI. So, now if your page has these properties and properties are mapped properly on dialog, they should auto-populate.

 

Apologies, I need help to understand, where is the gap?

 


Aanchal Sikka

Avatar

Level 2

Hello @aanchal-sikka 

 

we have "book page component" used in book template & "book details component" to be dragged in the book template.

 

My requirement is to fetch the book related information author has configured in the page properties & populate the same information as pre configured values in the book details component of the same page. In this component, when author opens the book details component, they should see the name, description & author information configured in the page properties & other information of the book can be authored in the component.

 

I am facing the issue to populate the "book page component" page properties data to "book details component" dialog fields.

 

Thanks

Sumit

 

Avatar

Community Advisor

Hello @S__k__Agarwal 

 

Please refer to the OOTB Teaser component, it has a similar functionality.

The values are not copied, but the values are displayed in HTML using Page's properties.

 

In the Sling Model, if the property exists in component that can be given priority, else it can be picked from the encapsulating Page, 


Aanchal Sikka

Avatar

Level 2

Hello @aanchal-sikka 

 

I already referred to the OOTB Teaser component.

 

For me also, the page properties values are displaying in HTML by exposing the data through getters.

 

But I need to populate the data in component dialog fields. Can you please suggest any solution.

 

Thanks,

Sumit

Avatar

Correct answer by
Community Advisor

Hi @S__k__Agarwal 
Teaser is the correct example.

1. you make a ajax call to page and get the information and populate in a dialog on dialog load event. make sure you disabled this fields otherwise data will be stored in jcr

2. When you do the rendering, render this data from page properties.

 

If you want to populate the value just to prefill before authoring, then you don't need to make disabled and read from the component.



Arun Patidar

Avatar

Administrator

@S__k__Agarwal  Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni