p:poll returns undefined on "oncomplete" function

1k views Asked by At

I have a strange problem (maybe a bug) with the poll compontents and trying to return values at callback. Because the Poll element returns undefined on "oncomplete" function called.

I don't understand why args are always undefined. I tried all. Logs always says undefined of args parameter.

It seems a problem of "poll" element, becouse if i use "commandButton" all works perfectly and the args returns are corrects... Why?


Mojarra 2.2.8, PrimeFaces 5.2, Tomcat 7


This is my dash.jsf:

<h:form>
<p:poll actionListener="#{markersView.save}" oncomplete="handlePollRequestComplete(xhr, status, args)" widgetVar="mypoll" />
</h:form>

    <script>
        function handlePollRequestComplete(xhr, status, args) {
            PrimeFaces.debug("Save:" + args.saved);
        }
    </script>

MarkersView.java:

import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import org.primefaces.context.RequestContext;
import org.primefaces.model.map.DefaultMapModel;
import org.primefaces.model.map.LatLng;
import org.primefaces.model.map.MapModel;
import org.primefaces.model.map.Marker;

@ManagedBean
public class MarkersView {

    private MapModel simpleModel;

    @PostConstruct
    public void init() {

    }

    public void save() {
        RequestContext context = RequestContext.getCurrentInstance();
        context.addCallbackParam("saved", "true");    //basic parameter



    }

}

Log PrimeFaces:

20/6/2015, 11:07:25 : Initiating ajax request.
20/6/2015, 11:07:25 : Form to post j_idt12.
20/6/2015, 11:07:25 : URL to post /dash.jsf.
20/6/2015, 11:07:25 : Post Data:javax.faces.partial.ajax=true&javax.faces.source=j_idt12%3Aj_idt13&javax.faces.partial.execute=%40all&j_idt12%3Aj_idt13=j_idt12%3Aj_idt13&j_idt12=j_idt12&javax.faces.ViewState=6291534270084680507%3A9051076211686237374
20/6/2015, 11:07:25 : Response received succesfully.
20/6/2015, 11:07:25 : DOM is updated.
20/6/2015, 11:07:25 : Save:undefined
20/6/2015, 11:07:25 : Response completed.

The response log:

<?xml version='1.0' encoding='UTF-8'?>
<partial-response id="j_id1"><changes><update id="j_id1:javax.faces.ViewState:0"><![CDATA[1663230282338470443:-2846533344041645415]]></update></changes></partial-response>
0

There are 0 answers