Freelancer Martin Zeller

php asp.net java c# .net c++ xml xhtml seo magento zend framework dotnetnuke tomcat iis sql server mysql oracle typo3 coremedia

Automatic resizing of wickets ModalWindow

Tags: , , ,

Today I ran into problems with wickets ModalWindow. I have got a modal dialog with a list and a form in it. The user can add a row to this list with the form. Problem was that the size of the modal window stayed as it was although the list was growing and growing. Nasty scroll bars appeared around my modal dialog. So I’d like to make the dialog to “auto resize” on each post.

My solution was simple. I just added this line of code in the onsubmit handler of the ajax button:

// in the onsubmit handler of the ajax button
target.appendJavaScript("window.parent.Wicket.Window.current.autoSizeWindow();");
//

It’s like magic. Now the modal dialog always has the proper size ;-)
(Tested with wicket version 1.5.5)

© 2009 Freelancer Martin Zeller. All Rights Reserved.

This blog is powered by the Wordpress platform and beach rentals.