Friday, April 11, 2014

Oracle APEX, set value of shuttle via javascript


In Oracle APEX Javascript API, you would typically set the value of page item by 

$x('P1_ITEM').value = 5;

This would work with textfields, select list. But for more complex input items like shuttle, it would not work.

If one examines an APEX shuttle item with Firebug or Chrome Dev tools, one can see its composed of 2 items fields, suffixed with "_LEFT" and "RIGHT".


Solution is to use apex.item("<<name of item>>")>setValue(<<value>>); which takes into consideration the item type.

apex.item( "P1_ITEM" ).setValue( "10" );

You can read more about apex.item in the Oracle documentation for APEX's JavaScript API:
http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/javascript_api.htm#AEAPI29494

No comments:

Post a Comment