Permalink
Browse files

#1900

1 parent 6d9cf8d commit 1252c88934763c02d379a6f417b03c0651fa931e @tandraschko tandraschko committed Feb 15, 2017
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/main/resources/META-INF/resources/primefaces/core/core.ajax.js
@@ -345,13 +345,26 @@ if (!PrimeFaces.ajax) {
sourceId = $(cfg.source).attr('id');
}
+ var $source = $(PrimeFaces.escapeClientId(sourceId));
+
+ // if the source doesn't exist in the DOM anymore, skip the request
+ // see #1900
+ if ($source.length === 0) {
+ PrimeFaces.warn("Skip AJAX request as the source element doesn't exist anymore. Id: " + sourceId);
+ //remove from queue
+ if (!cfg.async) {
+ PrimeFaces.ajax.Queue.poll();
+ }
+ return false;
+ }
+
if(cfg.formId) {
//Explicit form is defined
form = PrimeFaces.expressions.SearchExpressionFacade.resolveComponentsAsSelector(cfg.formId);
}
else {
//look for a parent of source
- form = $(PrimeFaces.escapeClientId(sourceId)).closest('form');
+ form = $source.closest('form');
//source has no parent form so use first form in document
if (form.length === 0) {

0 comments on commit 1252c88

Please sign in to comment.