When you create a form or a report, most of the time this is done with the help of a wizard. It is very easy for the most common things but if you want a different width of a text item, other than the default width, you have to do this afterwards. When you have a lot of items on your screen this could be very cumbersome. In this recipe, we will show you how to set the default width of columns with the APEX_UI_DEFAULT_UPDATE.UPD_ITEM_DISPLAY_WIDTH
procedure. We will set the default width of column EVENT
in table APP_EVENTS
to 200.
Before you can use this function, the table needs to be included in the APEX dictionary. The view APEX_UI_DEFAULTS_COLUMNS
holds the columns and their default width. You can add your table to this dictionary view by doing the following:
exec apex_ui_default_update.synch_table('APP_EVENTS'),
[1346_07_11.txt]
The only difference is that in the APEX builder, all tables will be included at once and in SQL plus you have to do this for every table separately (OK, you could write a script).
If you ignore these steps, the table with the columns you wish to set the default width for might not be in the APEX dictionary, and the steps in the next paragraph will lead to a "ORA-20001: UI Default update failed - there is no associated table" error message.
begin apex_ui_default_update.upd_item_display_width( p_table_name => 'APP_EVENTS' ,p_column_name => 'EVENT' ,p_display_width => 200); end; / [1346_07_12.txt]
This small procedure calls the APEX_UI_DEFAULT_UPDATE.UPD_ITEM_DISPLAY_WIDTH function and sets the display width of column EVENT in table APP_EVENTS to 200.
EVENT
column, go to the application builder, go to your application, and click the Create page button. APP_EVENTS
table. In this case it is ID, so select ID and click Next. APP_AET_SEQ
and click Next.The call to the function actually updates the APEX dictionary view. You can see that when you do a query on APEX_UI_DEFAULT_COLUMNS
where table_name
is APP_EVENTS
and column name is EVENT:
select table_name , column_name , label , display_width , display_in_form from apex_ui_defaults_columns where table_name = 'APP_EVENTS' and column_name = 'EVENT';
[1346_07_13.txt]
The result is as follows:
The display width is adjusted to 200.
3.14.245.167