user964819
user964819

Reputation: 353

Unable to call server listener from Java script

Jdev Version :11.1.1.7.1 I have a Java script method ,to calla bean method via server listener and it looks as below.

JS method :

 onSelection : function (itemId, metadata) {
    //        alert (itemId);
    AdfCustomEvent.queue(null, "ServerEvent",
    {
        itemId : itemId
    },false);
    return true;
    }

ServerListener:

<af:serverListener type="ServerEvent"
                 method="#{pageFlowScope.contentBean.handleEvent}"/>

Bean Method:

public void handleEvent(ClientEvent clientEvent) {
     logger.info("Start of method()");
     String itemId = (String)clientEvent.getParameters().get("itemId");

}

the control goes to the JS method and i can see all the variables have been assigned values ,but the bean method does not get invoked from the JS via server listener.

Can any one tell me what exactly am i doing wrong here.

Upvotes: 0

Views: 1678

Answers (1)

Aslam a
Aslam a

Reputation: 759

The JavaScript contains the AdfCustomEvent.queue method that takes the event source. But you are passing null.

Its mandatory to pass the event source. Below is the example code.

      AdfCustomEvent.queue(event.getSource(), "deleteRows", param, true);

      AdfCustomEvent.queue(null, "deleteRows", param, true); // invalude

Upvotes: 2

Related Questions