1

I would like to call javascript function in vaadin. Its a AbstractJavaScriptExtension. this.callFunction("removeNode"); does not fire the javascript function. Is this a bug or am I doing something wrong?

@Override
public void remove() {
    super.remove();
    fireRemoveNode();
    this.callFunction("removeNode");
}

JavaScript code:

window.vaadin_components_graph_Node = function() {
        var self = this;
        var state = this.getState();

...

        this.removeNode = function() {
            console.log("CALL FUNCTION", "remove node")
            $(node).remove();
        }
};
1
  • at first glance, this all looks correct. the component in general is working (aka: there are no deeper problems)? also to have it said: you are aware, that the server will not call this function on it's own on the client without the context of a request (or push enabled maybe) Commented Apr 23, 2015 at 8:47

2 Answers 2

2

You can't call JavaScript functions after the AbstractJavaScriptExtension is removed. Try placing this JavaScript call to another method and don't call remove();

Sign up to request clarification or add additional context in comments.

Comments

0

While user1411778 answer is correct, you can also call JavaScript function using:

JavaScript.getCurrent().execute("removeNode()");

It should work always.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.