Monday, January 02, 2012

Modifying size of text boxes

You probably ran into this problem when using Maximo: Maximo sometimes does not display all the characters in a field, because the text box is too small. Of course, you can solve this. First you need to understand how Maximo determines the display size of the text box. Then you can change these setting and control how large the text box should be.


Understanding text box sizes
Maximo uses the database field size and the settings in fieldsizegroups.jsp to determine the display size of a text box on the screen. In fieldsizegroup.jsp, there is a table containing the different display sizes in relation to the database field size and the data type.
Example:
     //For ALN, LOWER, UPPER field types
     fieldtypegroup = new Hashtable();
     fieldtypegroup.put(new Integer("2"), new Integer("2"));
     fieldtypegroup.put(new Integer("30"), new Integer("10"));
     fieldtypegroup.put(new Integer("31"), new Integer("40"));

This means that for fields of type ALN, LOWER and UPPER:
  • the display size is 2 when the database field size is smaller or equal to 2
  • the display size is 10 when the database field size is smaller or equal to 30
  • the display size is 40 when the database field size is equal or greater than 31
Modifying settings
To modify the display size of a field, you can do two things: 1) change the database field size so that it falls in a different range, e.g. for a field with an UPPER field type, increasing the database field size from 15 to 35 will increase the display size from 10 to 40. 2) change the ranges and sizes in fieldsizegroup.jsp. Example:
     fieldtypegroup.put(new Integer("2"), new Integer("2"));
     fieldtypegroup.put(new Integer("20"), new Integer("20"));
     fieldtypegroup.put(new Integer("30"), new Integer("30"));
     fieldtypegroup.put(new Integer("31"), new Integer("40"));

Changing the fieldsizegroups.jsp ranges will affect the display size of all fields of the specific data type. Changing the database size will affect all the text boxes that are based on that attribute.

Note: Changes to the file fieldsizegroups.jsp will only take effect after you build and deploy the maximo.ear file.

But there is also a trick: if you want to change the display size of only one field on a specific application screen, you can override the settings in fieldsizegroups.jsp. You do this by adding USEFIELDSIZEGROUP="FALSE" to the text box properties in the application xml. Maximo will then use the database field size as the display size.
Example (from asset.xml):
     <textbox dataattribute="assetnum" id="1247661239277" inputmode="READONLY" usefieldsizegroup="false"/>





No comments:

Post a Comment

Comment now »