Fileuploader only uploads first file if an BlockUI component is in the same view, Primefaces

Environment:
I´m using common Primefaces 3.5. with JSF 2.1 and JDK 1.7.
Application server is glassfish 3.

Problem:
If i use an UIBlock component in the same view as the fileuploader, 
the fileuploader only processes the first file.
Testet with different commons-io and commons-fileuploader libs.
Testet on single view with only these two components in it.

Workaround:
After removing the UIBlock Element the fileuploader is working fine again.

Greetings

Martin


Jul 10, 2013

#1 dpearson…@gmail.com

Check out the last post in this topic. 
I had a block UI file upload problem even when they weren't in the same dialog. 
It seems they are incompatible. This fixed my issue so maybe yours is related.

http://forum.primefaces.org/viewtopic.php?f=3&t=23008

I overloaded the function in my own primefaces control javascript file with
Primefaces.widget.BlockUI.prototype.bindTriggers = function {
code from that post
}

Being able to do this is pretty handy b/c you don’t have to break open the primefaces
source and update it yourself.
I’ve had to do this for a few other issues as well that just needed some if checks.

 

The post:

I had the same problem. I think it is related to the fileUpload more than blockUI cause the ajaxComplete triggered has no parameter in it…Anyway i resolved this with a patch to the primefaces.js modifying the blockUI widget bindTriggers method like this:

Code:
bindTriggers:function(){var a=this,b=this.cfg.triggers.split(",");$(document).bind("ajaxSend",function(d,f,c){if(c){if($.inArray(c.source,b)!=-1){a.show()}}});$(document).bind("ajaxComplete",function(d,f,c){if(c){if($.inArray(c.source,b)!=-1){a.hide()}}})}
bindTriggers:function(){
var a=this,b=this.cfg.triggers.split(",");
$(document).bind("ajaxSend",function(d,f,c){if(c){if($.inArray(c.source,b)!=-1){a.show()}}});
$(document).bind("ajaxComplete",function(d,f,c){if(c){if($.inArray(c.source,b)!=-1){a.hide()}}})
}

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s