@Marius: Ok, so storing the original function somewhere else, could be a solution. But i would have a JS to make this and call it from Vaadin. Or is there an extension/component, where i can write Java-Script functions and add them to the client? (like addFunction, but with JS code?)
This is first idea… you can call imaginary function server_alert (without any declaration in js file), you will be redirected to your function handler (do something) and if you are done you can call original function (declared in js) by native method (for example callClientAlert with parameter text to show in alert).
Or you can try all of this but at first part you will not override imaginary function server_alert but rather original alert, and the by native method call original. But i’m warried about loop which can create. I’m not really sure how this work at the lowest level.
// i’m thinking about native method … it will not work. Try Javascript.execute(“window.alert(‘tralalalala’)”);
When you then call alert(‘Something’) it will log Doing something else in your Developer Tools’ JS console.
@Mário
The callClientAlert function can only be declared in a client-side/GWT Module and if I would go so far as to create an extension or a Custom client-side Component to achieve this i would do the part with adding the function also on the Client. There you could even attach your own Js File in the head containing the function.
…I just had an idea. You could probably use
this technique to modify the Bootstrap Page and add a script tag to the Header by getting the response and append your tag to the head.
@Marius
Yes yes … at the end of my post i comment last line in which i agree that wouldn’t work because the code is in server side not in client and native work only on client. so i suggested the call of Javascript.execute(…)
I was hurry in writing so i dont delete wrong suggestion
I have a .js file that is d3 and i want to call with JavaScript.getCurrent().addFunction…how i can do this… i am getting lot of confusion regarding this!!!