Use the apex.widget
namespace to store all the general purpose widget related functions of Oracle Application Express.
Topics:
Given the Application Express page item name or the DOM node, different callbacks and properties can be registered for a page item. This is necessary to seamlessly integrate a plug-in item type with the built-in page item related client-side functionality of Application Express.
For more information about implementing plug-ins, see "Implementing Plug-ins" in Oracle Application Express Application Builder User's Guide:
For samples authored by Oracle, see the plug-in repository, on OTN:
http://apex.oracle.com/plugins
Return Values
None.
Parameters
Table 23-16 describes the available parameters for this function.
Table 23-16 Parameters for apex.widget.initPageItem( pName, pOptions )
Name | Type | Optional/ Required | Default | Description |
---|---|---|---|---|
|
(DOM Node|String) |
Required |
Application Express page item name or DOM node. |
|
|
(Object) |
Required (individual properties are optional) |
Supports many properties to specify callbacks and certain item-specific values. Specifying any of these properties will override the default behavior of Application Express for that particular property. See Table 23-17 for
|
Table 23-17 Properties for the pOptions parameter
Name | Description |
---|---|
|
Specify a function for getting the item's value, which overrides the default page item handling. Ensuring the item returns its value correctly means certain item related client-side functionality of Application Express still works, for example in Dynamic Actions to evaluate a When condition on the item, or when calling the JavaScript function $v to get the item's value. See "apex.item( pNd ).getValue()", for details on how to define this function. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for setting the item's value, which overrides the default page item handling. Ensuring the item can set its value correctly means certain item related client-side functionality of Application Express still works, for example when using the Set Value action of a Dynamic Action to set the item's value, or when calling the JavaScript function $s to set the item's value. Note: Even if this function is defined, the default handling always handles the logic associated with the See the "apex.item( pNd ).setValue(pValue, pDisplayValue, pSuppressChangeEvent)", for details on how to define this function. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for enabling the item, which overrides the default page item handling. This could be useful for example where the item consists of compound elements which also need enabling, or if the item is based on a widget that already has its own enable method that you want to reuse. Ensuring the item can enable correctly means certain item related client-side functionality of Application Express still works, for example when using the Enable action of a Dynamic Actions, to enable the item. Note: Even if this function is defined, the default handling always handles the logic associated with the See the "apex.item( pNd ).enable()", for details on how to define this function. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for disabling the item, which overrides the default page item handling. This could be useful for example where the item consists of compound elements which also need disabling, or if the item is based on a widget that already has its own disable method that you want to reuse. Ensuring the item can disable correctly means certain item related client-side functionality of Application Express still works, for example when using the Disable action of a Dynamic Action to disable the item. Note: Even if this function is defined, the default handling always handles the logic associated with the See the "apex.item( pNd ).disable()", for details on how to define this function. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for showing the item, which overrides the default page item handling. This is useful for example where the item consists of compound elements which also need showing, or if the item is based on a widget that already has its own show method that you want to reuse. Ensuring the item can show correctly means certain item related client-side functionality of Application Express still works, for example when using the Show action of a Dynamic Action, to show the item. See the "apex.item( pNd ).show( pShowRow )", for details on how to define this function. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for hiding the item, which overrides the default page item handling. This could be useful for example where the item consists of compound elements which also needs hiding, or if the item is based on a widget that already has its own hide method that you want to reuse. Ensuring the item can hide correctly means certain item related client-side functionality of Application Express still works, for example when using the Hide action of a Dynamic Action, to hide the item. See the "apex.item( pNd ).hide( pHideRow)", for details on how this function should be defined. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function for adding a value to the item, where the item supports multiple values. Currently there is no client-side functionality of Application Express dependent on this. There is also no default page item handling. Note: Even if this function is defined, the default handling always handles the logic associated with the See the "apex.item( pNd ).addValue( pValue )", for details on how this function should be defined. |
|
Specify a value that to be used to determine if the item is null. This is used when the item supports definition of a List of Values, where a developer can define a Null Return Value for the item and where the default item handling needs to know this in order to assert if the item is null or empty. This can be done by following these steps:
|
|
Specify the element to receive focus, when focus is set to the item using the Ensuring the item sets focus correctly means certain item related client-side functionality of Application Express still works, for example when using the See the "apex.item( pNd ).setFocus()", for further details of this API. Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check this by adding the item as the first item on a page, where the page has the page attribute |
|
Specify the element to receive style, when style is set to the item using the Note: Even if this property is defined, the default handling still always handles the logic associated with the See the Note: You should first check if the default handling of Application Express works for the item, because in that case you do not need to specify this. You can check by calling |
|
Specify a function that is called after an item is modified. This is useful, for example as some frameworks such as jQuery Mobile need to be notified if widgets are modified, for example their value has been set, or they have been disabled in order to keep both the native and enhanced controls in sync. This callback provides the hook to do so. |
|
Specify a function that normalizes how the item's loading indicator is displayed during a partial page refresh of the item. This function must pass the This is used, for example, if the item is a |
Examples
The following example shows a call to apex.widget.initPageItem
with all the available callbacks and properties passed.
apex.widget.initPageItem( "P100_COMPANY_NAME", { getValue: function() { var lValue; // code to determine lValue based on the item type. return lValue; }, setValue: function( pValue, pDisplayValue ) { // code that sets pValue and pDisplayValue (if required), for the item type }, enable: function() { // code that enables the item type }, disable: function() { // code that disables the item type }, show: function() { // code that shows the item type }, hide: function() { // code that hides the item type }, addValue: function( pValue ) { // code that adds pValue to the values already in the item type }, nullValue: "<null return value for the item>", setFocusTo: $( "<some jQuery selector>" ), setStyleTo: $( "<some jQuery selector>" ), afterModify: function(){ // code to always fire after the item has been modified (value set, enabled, etc.) }, loadingIndicator: function( pLoadingIndicator$ ){ // code to add the loading indicator in the best place for the item return pLoadingIndicator$; } });