AbstractJavaScriptExtension callback

Hello everybody.

I created custom extension (extend AbstractJavaScriptExtension).

By javasript library i add some logic to main layout, and i wanna to call server-side extension to inform about changes or events which this element will fire.

I found solution, but i need another one. So any suggestions?

This is the code (js) where i wanna contact server side:

function scrollbar_handler(){
  if (getX() == getY()) {
      [b]
callback(); 
[/b]
  }
}
 

Use a ServerRPC:
Using RPC from Javascript

I knew there is posibility about RPC but didn’t know how to call it from javascript. Thanks i try it :slight_smile: you helped me very much :wink: thanks :wink:

Ok i tried it and dont work.

#!java
registerRpc(new AutoLoadServerRpc() {
  @Override
  public void callback() {
    fireCallbackEvent();
  }
});
#!javascript
var rpcProxy = this.getRpcProxy();

function handler() {
  if (getX() == getY()) {
    callback(); //works
    rpcProxy.callback(); //don't works
  }
}

Well what didn’t work?
Check if you have any JS errors, if the version of the Js file on the client is actually the current one, if the RPC is set up correctly and if the Rpc maybe is actually working but there is something wrong with the event call on the server side.

The actual RPC mechanism should work like a charm so there must be something weird in the way you implemented it.

Marius → i found the problem. I used method name attach (and my IDE didn’t used annotation override) so it used my implementation without super impementation. It works only for 50%.

Thanks for help and information :slight_smile: