Refresh of Parent Form Belonging to Portlet Project 1 from Other Form Belonging to Portlet Project 2

Hi Experts,

Currently facing problem in refreshing the Parent Form from some other form . The project has been designed in the following way :

We have a CAF Portlet Project 1 where we have a Portlet 1 . Then we have a CAF Portlet Project 2 where we have Portlet 2 and along with this we have multiple views along with default view containing modal dialog box in all of them . In Portlet 1 we have included Portlet 2 and trying to display various modal dialogues belonging to Portlet 2 by calling the async hidden buttons present in the default view of Portlet 2.

Our issue is that we are unable to refresh the Parent form( basically the Portlet 1 ) when we close the modal dialog box belonging to Portlet 2 . Is there anyway we could achieve this by going forward with this Architecture ?

Please review the “External Portlet References” section of the CAF Development Help documentation.

Hi Eric,

Very Good morning to you . Thank you for the providing the details . I did browse through that topic but somehow fail to achieve this :frowning:

Could you provide me with a sample project ?

Hope this is fine with you.

Regards,
Nischal

Attached a sample project that demonstrates it.

Deploying the sample will create a test page under Public Folders which you should be able to access as http://localhost:8585/test.page1

refresh_other_portlet_demo.zip (26.7 KB)

Hi Eric,

This is amazing thank you for that sample portlet and for your time , it is good to know how this could be done when a Portlet Project contains multiple Portlets and we could refresh one another Portlets from each of them .

Could this same logic work , when i have two Portlet Projects say Portlet Project one containing Portlet 1 and Portlet Project 2 containing Portlet 2 and i try to acheive this refreshing across Portlet Projects ?

Thank you in advance for answering the queries.

Regards,
Nis

Yes the ‘External Portlet Reference’ determines what to refresh by resolving the URI or alias of the target portlet instance, so it can locate a control to refresh from any CAF project that is deployed to MWS.

Yayyyyyy it worked :slight_smile: Once again thanks alot .

Now my scenario is like i have a Portlet Project 1 having Portlet 1 , Portlet Project 2 having Portlet 2 and Portlet Project 3 having Portlet 3 . The Portlet 3 is included in the Portlet Project 1 and Portlet Project 2 as well. In my application i show Portlet 1 for a specific role say “X” and Portlet 2 for a specific role say “Y”. So when i refresh from Portlet 3 which is included in both the other Portlets i.e. Portlet 1 and Portlet 2 how could i achieve refresh of only individual ones ( since Portlet 1 displayed to role X and Portlet 2 displayed incase of role Y) ? Could this be acheived ?

Regards,
Nis

For simple conditional logic, you can bind the “Refresh” property of the command button to a conditional expression that could calculate what to refresh based on your role.

For example using the ternary operator to do an “condition ? value_if_true : value_if_false” statement like this:

#{request.isUserInRole('administrator') ? 'id_if_true' : 'id_if_false'}

Of if your logic becomes more complex, you can do the calculation in a java method in your page bean and bind the “Refresh” property to that java method.