View Full Version : Width on elements does not accept percentage.

Oct 10, 2008, 6:31 PM
 There are certain situations where setting a width of a percentage is useful.  Any time you try to set the with on say a "text" box or some other type <ext: control you always get the error below: Is there anyway to allow a percentage to be specified?

<h2>The Unit Type for the uid Width property must be of Type 'Pixel'.
Example: Unit.Pixel(150) or '150px'. </h2><h2>

Oct 10, 2008, 9:38 PM
Hi JMan,

The majority of the "Width" properties will only accept Pixels, although there may be exceptions to that rule and certain work-arounds depending on the scenario.

It's a bit tough to give you a definitive answer, although if you are using form controls (TextField, etc) you can use an AnchorLayout or FormLayout and set the Horizontal property of the <ext:Anchor>. There are certainly options with the TableLayout as well. 

The following ExtJS documentation provides further information re: the AnchorLayout, see http://www.extjs.com/deploy/dev/docs/?class=Ext.layout.AnchorLayout

Hope this helps.