Populate Page Properties Data to Component Dialog | Community
Skip to main content
New Participant
October 12, 2023
Solved

Populate Page Properties Data to Component Dialog

  • October 12, 2023
  • 2 replies
  • 1331 views

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 

 
 
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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


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.

2 replies

kautuk_sahni
Employee
October 13, 2023

@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
New Participant
October 13, 2023
aanchal-sikka
New Participant
October 12, 2023

@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
New Participant
October 12, 2023

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

 

aanchal-sikka
New Participant
October 12, 2023

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