We are writing an AJAX-heavy Wicket application and have panels that are contributing CSS via renderHead()
. However, when panels are being replaced via AJAX - say, via an AjaxTabbedPanel
, the header contributions of the old panels remain and pollute the rest of the application. Apart from response bloat, this causes issues when CSS declarations are overly generic and thus result in rendering issues in other areas of the application.
Is there a way around this? Say, a mechanism to re-create the IHeaderReponse
when a panel has been replaced / is no longer visible?
For what it's worth, an example of our header contributor is:
@Override
public void renderHead(IHeaderResponse response) {
response.renderCSSReference(new SharedResourceReference(SearchMainPanel.class, "Search.css"));
}
We're using Wicket 1.5.3.
I have had success with a custom label which renders a <link rel="stylesheet" ... />
in the Panel's <body>
markup (i.e., not using header contributors), however IE8 refuses to acknowledge the presence of this CSS - hence having to rethink our strategy.