For example, if you start with something like this:
<h:panelGroup id="grid">...</h:panelGroup> <p:commandLink update="grid" actionListener="#{bean.update1}" onComplete="updateGrid()"/> <p:commandLink update="grid" actionListener="#{bean.update2}" onComplete="updateGrid()"/> <p:commandLink update="grid" actionListener="#{bean.update3}" onComplete="updateGrid()"/>
You could pull the updateGrid() statement out into an AJAX listener like this
jQuery(document).ajaxComplete(function(e, xhr, opts) { $response = jQuery(xhr.responseXML); if ($response.find("div[id$='grid']").length > 0) { updateGrid(); } });
By using ajaxComplete and parsing the XHR response object, you can see which DIV was going to be impacted by the partial update. That way, if you had some other AJAX controls (say, an autocompleter) that you didn't want to trigger the updateGrid() function, you could filter that out. Another option would be to set global=false on the specific Primefaces components that you don't want to fire the global jQuery ajaxComplete event. The Primefaces autocompleter doesn't support this in Primefaces 2.x but does in 3.0.