Hi Rob,

the 'correct' way to solve this?

the component is explicitly added to the Ajax request for an update, but 
decides to hide itself in onConfigure().
Perfectly valid usecase IMHO, but the head will be rendered nevertheless :/

Just tested with 7.x, 8.x and master, this seems to have been that way forever.
But maybe we can improve that in Wicket core?

Sven


On 20.01.20 10:36, Rob Audenaerde wrote:
Hi all,

I recently got some javascript errors that came from behaviors of
components that where triggered to be visible or invisible in the dom
(using onConfigure()) in an ajax request.

Typically something like:

Wicket.Ajax:  Cannot bind a listener for event "change" on element
"format1dd" because the element is not in the DOM

I solve this by adding an isVisibleInHierarchy() check in the renderHead()
like this:

@Override

public void renderHead(final Component component, final IHeaderResponse
response) {
     if (component.isVisibleInHierarchy()) {
         super.renderHead(component, response);
     }
}

I was wondering if this is the 'correct' way to solve this? Or am I doing
something wrong?

Please advise :)

-Rob


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to