Primefaces p:dialog minWidth, minHeight. Bug

p:dialog is a handy JSF component (by Primefaces), especially with a lot of controls available (ajax integration etc.).
I ran into a small tiny bug with minWidth and minHeight, the component won’t set these values into the style.

it’s always auto unless I define a width and height which is not my target, my primefaces version is 3.5.

so I had to let jQuery handle this issue by selecting the class of my dialog and add these missing style attributes.

First make sure you set the styleClass into “dialog-fix” or whatever you like (this class name is used by jQuery selector)


....


And here’s the jQuery function

/**
* this js function would fix p:dialog minWidth and minHieght Bug in primefaces
* just don't forget to include styleClass into p:dialog as dialog-fix for jQuery Selectors
* for more info, I issued a bug ticket https://code.google.com/p/primefaces/issues/detail?id=5769
* Hatem Alimam
*/

$(function() {
$('.dialog-fix').css("min-width", "400px");
});

In that way I overcome this bug (at least for now).

For more info I issued a bug ticket

If you think something is wrong please feel free to comment :)

Leave a reply.