Tuesday 5 February 2013

How to Refresh dialog after JCR data change in CQ5.4


There has to be a refresh functionality in one of the real development case. A custom dialog in CQ5.4, which having below functionality,

    A static text which shows some information based on data found in CRX repository; Having a button which -when pressed- will call a servlet, generating a bunch of pages.
    After pages have been created successfully, we need the dialog to get "refreshed" automatically in order to show the updated information in CRX repository. Ideally, the dialog should reload from scratch but which is not working in actual.

SOLUTION:


Let us do this by,

<refresh jcr:primaryType="nt:unstructured"   handler="function(){window.location.reload();}"   text="Refresh"/>
           
           
Otherway is, if the call to the servlet not an ajax call then we could register a callback to refresh the custom widget, once the ajax call was success full. How to use ajax calls with jQuery for building components in CQ5 is shown here:

No comments:

Post a Comment