PDA

View Full Version : Customizing JModalPanel



Anders Ohrt
1-Jun-2007, 10:09 AM
I wanted some flashy borders on my JModalPanel (XP style), but there are too
few div's to get everything I need. Is there some way I can hook into the JS
that I have not found or is the only way to change the constructor (which I
did reluctantly)? How about the possibility to create my own invisible modal
panel and set some property and instead of the library creating it, it would
just position and display it?

BTW, since working with the Ajax library I've noticed I really hate CSS. It
can do anything, but you can never figure out _how_! =)

// Anders

Edwin van der Velden
4-Jun-2007, 05:58 AM
Currently the best way would be to redefine the
JModalDialog.prototype.createDialog in your own page, if you redefine it you
won't have to adjust it again for a new version. However I have also
implemented the option to use a custom predefined modal dialog as you
suggested, you simply add the dialog to your html as:

<div id="popupContainer" class="popupContainer" style="display: none;">
<div id="popupTitleBar" class="popupTitleBar">
<div id="popupTitle" class="popupTitle">Lookup</div>
<div id="popupControls" class="popupControls">
<a href="javascript: JModalDialog_Hide();" id="a"><img
src="Images/ModalDialog/Close.gif" id="img"/></a>
</div>
</div>
<div id="popupInner" class="popupInner"></div>
</div>
note: this dialog example will look exactly the same as the generated
dialog ;-)

Then you simply need to set vdfContainer="popupContainer" on your lookup (or
in case of other types of dialogs slightly different but jsut as easy, more
details will be available in the documentation included with the next
release) and it will create a copy of your predefined modal dialog (this way
support for multiple dialogs at once won't break) and use it instead of
creating a new modal dialog. If you don't set vdfContainer, or the id you
give in vdfContainer doesn't belong to any element it will simply use the
old method as it is now to create a dialog.


-Edwin


"Anders Öhrt" <Anders.Ohrt@berendsen.se> wrote in message
news:Sc5QF7FpHHA.2832@dacmail.dataaccess.com...
>
> I wanted some flashy borders on my JModalPanel (XP style), but there are
> too few div's to get everything I need. Is there some way I can hook into
> the JS that I have not found or is the only way to change the constructor
> (which I did reluctantly)? How about the possibility to create my own
> invisible modal panel and set some property and instead of the library
> creating it, it would just position and display it?
>
> BTW, since working with the Ajax library I've noticed I really hate CSS.
> It can do anything, but you can never figure out _how_! =)
>
> // Anders
>

Anders Ohrt
4-Jun-2007, 06:13 AM
> Currently the best way would be to redefine the
> JModalDialog.prototype.createDialog in your own page, if you redefine it
> you won't have to adjust it again for a new version.

I didn't think of that, I'll keep that in mind if/when I need to augment the
library the next time. =)


> However I have also implemented the option to use a custom predefined
> modal dialog as you suggested, you simply add the dialog to your html as:
> [...]

Great, thank.

// Anders