0
votes

Is there a way to ajax refresh a header component, css style, with Wicket?

On an action from an user the application have to change the css-statements in the head of the page. Currently I am using a WebMarkupContainer with a wicket:head section and a CssContentHeaderItem, but that does not seem to get it done.

1
If you are overriding the stylesheet reference in the header you have re-render all components affected by the stylesheet change. - papkass
it is actually inline css, not a reference to a css file - haiko van der schaaf
I am not completely clear on your application, however I use AttributeModifier or AttributeAppender to update the css on a specific component. i.e.- to apply a selected css to a div (with wicket:id="container", I would put container.add(new AttributeModifier("class","selected")); then refresh the component. I guess I handle it by changing the css tag on the component while keeping the css reference static. Maybe some code and/or more explaination of what/why your are changing the css could help someone formulate a more useful answer. Good Luck! - OnesAndZeros

1 Answers

0
votes

Why change the css statements? I assume you are changing certain css-classes to make sure everything with the class 'label' is now green instead of red (or every '' tag is now green instead of red).

Why not simply add a different css-class to the component and keep both classes in the generated css?

That said, I believe adding a component to an ajaxrequest (AjaxRequest#add) will also call the renderHead method for that component.