Sunday, 8 January 2017

Plug-in for resizing modal dialogs

Some weeks ago I wrote about automatic resizing of modal dialog to fit the content. Since then my new hobby is Apex plug-in development, so I decided to create a plug-in for this. The plug-in works on Apex 5.0 and 5.1.

New resizing functionality for modal dialogs in Apex 5.1

In reaction to my previous post Shakeeb Rahman tweeted that the resizing was on of his favorite features of UT in Apex 5.1. After getting Apex 5.1 this was of course one of the first things for me to investigate. At first nothing happened, then I realised that the compatibility probably should be set to 5.1 in the Application properties:

And then the modal was indeed resized on load. But not always as I expected, as you see on the demo page On this page you can de-activate the plug-in. The application is set to Compatibility 5.1, so you can observe the new behavior. 
The report scales all right, but the dialog with the form items does not. It may be a timing issue, in that the display of the items happens after the setting of the height. 
So on Apex 5.1 the plug-in extends the new resizing functionality. 

The plug-in

Anyway, the Resize Dialog plug-in gives you control over the moment and the way of resizing. 
It is a Dynamic Action plug-in that can be called at Page Load or as in the example below on After Refresh for a report. The plug-in works on Apex 5.0 and Apex 5.1. 

Apart from resizing the plug-in also:
- guards the dialog from running of the page
- enables to define margins around the modal dialog
- enables vertical centering of the dialog

The margin size and the enabling of centering can be set with custom attributes. 

The plug-in can be downloaded on

Happy Apexing

No comments: