JavascriptComponent: detach()

Hi there,
I wrote a subclass of AbstractJavaScriptComponent and it’s working nicely. Now the problem is that I need to call a destroy method when the component is detached. I tried this:

public void detach() { callFunction("onDetach"); super.detach(); } And in my js connector (…-connector.js) :

this.onDetach = function() { ...destroy code... } But the method is not called. The detach() method on the server side is reached properly but the onDetach() method on the javascript side is not reached. It seems that “callFunction(…)” is not executed anymore because the component is being detached?!
Can anyone help me?

PS: I am using Vaadin 7.6.4

Hi Andrea,
in your javascript connector you can define the
onUnregister
function that will be called when component is detached;
the function is documented on
7.7 api
but is available also on prevoius releases.

HTH
Marco

Awesome, that works like a charm!

Andrea