Primefaces p:ajax listener conditional update -


jsf page:

<p:commandbutton>   <p:ajax process="@this" update="name desc msg"     listener="#{bean.deletelistener}"/> </p:commandbutton> 

bean:

public void deletelistener() {   if (data.size() == 0) {     // updates "msg"     setmsg("there no data delete");     return;   }   setmsg("data deleted.");   // , updates bean values "name" , "desc" also.   ... } 

is possible conditionally update ajax call based on ajax listener logic. update client ids "name desc msg" conditionally shown in listener code below (note sample scenario in larger application). application uses primefaces 5. thanks.

sure, use primefaces requestcontext in listener

requestcontext context = requestcontext.getcurrentinstance();  //update panel context.update("form:panel"); 

see also: - http://www.primefaces.org/showcase/ui/misc/requestcontext.xhtml


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -