Monday, April 13, 2009

Grid Panel as a form panel Element

We recently ran into a little problem in that we needed a grid panel to be displayed on a form panel. It displayed fine but it was left justified and made the form look pretty bad. One of my co-workers stumbled on to an undocumented feature that solves the problem. I just wanted to share it and post it for my own future reference.

For the life of us, we couldn't figure out how to tell the GridPanel to render in the fieldItem column and not the fieldLabel (All the other items let you define a fieldLabel property, but the GridPanel didn't have this option) column of the FormPanel. We finally found out that there is a property that is not documented anywhere, or anywhere that I can find, that tells the GridPanel that it is a formItem. So, in order to treat a GridPanel like a formItem all you have to do is set a property "isFormField" to true, slick huh. Now if you want to, you can also define a fieldLabel for that as well. This will align your GridPanel with all your other fieldItems.

Hope this is helpful.