Problems with RequestContext.addCallbackParam

UI Components for JSF
Post Reply
mshields
Posts: 2
Joined: 23 Jul 2010, 19:23

23 Jul 2010, 19:38

I am trying to use onselectComplete callback of a Tree component to run some Javascript when a node is selected. This part all works fine, but I am having problems with the addCallbackParam method. I am adding a domain object and in the ajax response, the key shows up, but the object is empty.

Code: Select all

    public void onNodeSelect(NodeSelectEvent event) {
        selectedTreeNode = event.getTreeNode();

        final Node node = (Node) selectedTreeNode.getData();
  
        RequestContext context = RequestContext.getCurrentInstance();
        context.addCallbackParam("node", node);
  }
the response:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><partialResponse><components></components><state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-1168101206675944887:-5517276692812948644" autocomplete="off" />]]></state><callbackParams><callbackParam>{"node":{}}</callbackParam><callbackParam>{"validationFailed":false}</callbackParam></callbackParams></partialResponse>
I have tried addCallbackParam with Strings and it seems to work, but it isn't marshalling our object. Any thoughts on what I should check?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

23 Jul 2010, 22:49

Hi,

Which version are you using?

Please take a moment and read forum posting guideline;

http://primefaces.prime.com.tr/forum/vi ... f=3&t=1194

Thanks.

mshields
Posts: 2
Joined: 23 Jul 2010, 19:23

26 Jul 2010, 15:15

Have tried Primefaces 2.0.3 and 2.1.RC1-SNAPSHOT on Glassfish 3.0.1 and Mojarra 2.0.2

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

26 Jul 2010, 23:47

Can you see what does this return in your test?

Code: Select all

new org.primefaces.json.JSONObject(yournode).toString();

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 44 guests