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
Solved! Go to Solution.
Views
Replies
Total Likes
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.
- 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?
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
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,
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.
@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.
Views
Replies
Total Likes
Done @kautuk_sahni
Views
Likes
Replies
Views
Like
Replies