Do you use Firefox with Firebug or some other browser / web developer tool that can show you the DOM element dlg
?
There you can find that dlg
has the methods show()
and hide()
, as well as enableModality()
and disableModality()
. These are (almost) what you want.
Unfortunately, enable...
and disable
don't (as one might think) set an option that makes the dialog become modal when shown. Rather they show or hide the "blackout" div. So when you want a dynamically modal dialog, instead of calling dlg.show()
via Javascript, call dlg.enableModality(); dlg.show()
, and vice versa for hiding.
Edit:
There is also the property dlg.cfg
which contains some settings. It appears that if you simply set dlg.cfg.modal=true
(whether that setting exists at the time or not), then the next time dlg
is shown, it's modal (but, unlike setting it in your xhtml, it will still be draggable and resizable).