Reputation: 107
I read in the Primefaces forum that updating dialogs in direct way or updating encircling elements should be avoided since the instances are duplicated and other strange behaviours. But we have some kind of a special case and would really need to update an element that contains lot of dialogs.
Is there really no way to do this in a same way without getting duplicated instances? How does it come to the duplicated instances? Could it be that this only happens when appendToBody
is set to true because it is updated and shifted once more to the body instead of just being updated?
Upvotes: 0
Views: 893
Reputation: 40
For Primefaces 3.5
PrimeFaces.widget.Dialog.prototype._show = function() {
this.jq.removeClass("ui-overlay-hidden").addClass("ui-overlay-visible").css({display:"none",visibility:"visible"});
if(this.cfg.showEffect){
var a=this;
this.jq.show(this.cfg.showEffect,null,"normal",function(){
a.postShow();
});
}
else {
//display dialog
/*Begin Custom Code*/
var dlg = jQuery(this.jqId);
if(dlg.size() > 1){
dlg.first().remove();
}
this.jq = dlg;
/*End Custom Code*/
this.jq.show();
this.postShow();
}
this.moveToTop();
if(this.cfg.modal){
this.enableModality();
}
}
Upvotes: 0
Reputation: 11
A solution is to fix the dialog.js, see Primefaces forum.
For Primefaces 3.4.1:
PrimeFaces.widget.Dialog.prototype._show = function() {
if(this.cfg.showEffect) {
var _self = this;
this.jq.show(this.cfg.showEffect, null, 'normal', function() {
_self.postShow();
});
}
else {
//display dialog
/*Begin Custom Code*/
var dlg = jQuery(this.jqId);
if(dlg.size() > 1){
dlg.last().remove();
}
this.jq = dlg;
/*End Custom Code*/
this.jq.show();
this.postShow();
}
this.focusFirstInput();
this.visible = true;
this.moveToTop();
if(this.cfg.modal)
this.enableModality();
}
Upvotes: 1
Reputation: 312
The dialog was reimplemented in v3.0. I think there are no problems now.
Upvotes: 0