Constructor
new ojPopup(options)
option().
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
options |
Object |
<optional> |
a map of option-value pairs to set on the component |
- Source:
- ojpopup/ojpopup.js, line 39
Examples
Initialize the popup with no options specified:
$( ".selector" ).ojPopup();
Initialize the popup with behaviors of a notewindow:
$( ".selector" ).ojPopup({initialFocus: 'none', autoDismiss: 'focusLoss', tail: 'simple'});
Initialize a popup via the JET ojComponent binding:
<div id="popup1" data-bind="ojComponent: {component: 'ojPopup'}">This is a popup!</div>
Fields
-
#autoDismiss :string
-
Defines conditions that will cause an open popup to auto close dismiss. A value of
focusLossdefines the dismissal condition where focus has left the content of the popup or from the associated launcher.- Default Value:
"none"
- Source:
- ojpopup/ojpopup.js, line 203
Supported Values:
Name Type Description "none"string disables auto dismissal behaviors. "focusLoss"string defines auto dismissal behavior when focus leaves the content of the popup or associated launcher. Examples
Initialize the popup with
autoDismissoption specified:$( ".selector" ).ojPopup( { "autoDismiss": "focusLoss" } );Get or set the
autoDismissoption, after initialization:// getter var autoDismiss = $( ".selector" ).ojPopup( "option", "autoDismiss" ); // setter $( ".selector" ).ojPopup( "option", "autoDismiss", "none" ); -
#chrome :string
-
Defines the presents of border, shadow and background color of the root popup dom. Value of
noneapplies theoj-popup-no-chromeselector defined by the active theme to the root dom of the popup to remove the default chrome.- Default Value:
"default"
- Source:
- ojpopup/ojpopup.js, line 227
Supported Values:
Name Type Description "default"string describes the popups border, shadow, and background color defined by the active theme. "none"string turns of the outer chrome defined by the active theme. Examples
Initialize the popup with
chromeoption specified:$( ".selector" ).ojPopup( { "chrome": "none" } );Get or set the
chromeoption, after initialization:// getter var chrome = $( ".selector" ).ojPopup( "option", "chrome" ); // setter $( ".selector" ).ojPopup( "option", "chrome", "none" ); -
#contextMenu :Object
-
JQ selector identifying the JET Menu that the component should launch as a context menu on right-click or Shift-F10. If specified, the browser's native context menu will be replaced by the specified JET Menu.
To specify a JET context menu on a DOM element that is not a JET component, see the
ojContextMenubinding.To make the page semantically accurate from the outset, applications are encouraged to specify the context menu via the standard HTML5 syntax shown in the below example. When the component is initialized, the context menu thus specified will be set on the component.
The JET Menu should be initialized before any component using it as a context menu.
- Default Value:
null
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 51
Examples
Initialize a JET component with a context menu:
// via recommended HTML5 syntax: <div id="myComponent" contextmenu="myMenu" data-bind="ojComponent: { ... }> // via JET initializer (less preferred) : $( ".selector" ).ojFoo({ "contextMenu": "#myMenu" });Get or set the
contextMenuoption, after initialization:// getter var menu = $( ".selector" ).ojFoo( "option", "contextMenu" ); // setter $( ".selector" ).ojFoo( "option", "contextMenu", ".my-marker-class" );Set a JET context menu on an ordinary HTML element:
<a href="#" id="myAnchor" contextmenu="myMenu" data-bind="ojContextMenu: {}">Some text -
#initialFocus :string
-
Determines if the popup should steal focus to its content when initially open. A value of
noneprevents the popup from grabbing focus when open.- Default Value:
"firstFocusable"
- Source:
- ojpopup/ojpopup.js, line 250
Supported Values:
Name Type Description "none"string prevents the popup from stealing focus when open. "initialFocus"string defines that a popup should grab focus to its content when open. Examples
Initialize the popup with
initialFocusoption specified:$( ".selector" ).ojPopup( { "initialFocus": "none" } );Get or set the
initialFocusoption, after initialization:// getter var initialFocus = $( ".selector" ).ojPopup( "option", "initialFocus" ); // setter $( ".selector" ).ojPopup( "option", "initialFocus", "none" ); -
#oj.ojpopup#widget
-
Returns a
jQueryobject containing the generated wrapper. This method does not accept any arguments.- Source:
- ojpopup/ojpopup.js, line 531
Example
Invoke the
widgetmethod:var widget = $( ".selector" ).ojPopup( "widget" ); -
#position :Object
-
Position object is defined by the jquery position API and is used to establish the location the popup will appear relative to another element. The postion object contains the following properties: "my", "at", "of", "colision", "using" and "within".
The "my" and "at" properties defines aligment points relative to the popup and other element. The "my" property represents the popups alignment where the "at" property represents the other element that can be identified by "of" or defauts to the launcher when the popup opens. The values of these properties describe a "horizontal vertical" location.
Acceptable "horizontal" alignments values are: "right", "center", "left", "start", "end". Note: Jet has added "start" and "end" options to be more RTL friendly. The Jet values of "start" and "end" normalize to "right" or "left" depending on the direction of the document.
Acceptable "vertical" alignment values are: "top", "center" and "bottom".
The following is a short summary of the most interesting positon properties:my- A "vertical horizontal" rule that defines the location of the popup used for alignment.at- A "vertical horizontal" rule that defines the location of the other element for used alignment. The other element is defined by "of" or defaults to the open launcher argument if not specified.
- Default Value:
{my: "start top", at: "start bottom", collision: "flip"}
- Source:
- ojpopup/ojpopup.js, line 292
Examples
Initialize the popup with
positionoption specified:$( ".selector" ).ojPopup( { "position": {"my": "left top", "at": "right top"} } );Get or set the
positionoption, after initialization:// getter var position = $( ".selector" ).ojPopup( "option", "position" ); // setter $( ".selector" ).ojPopup( "option", "position", {"my": "start bottom", "at": "end+14 top" } ); -
#rootAttributes :Object|undefined
-
Attributes specified here will be set on the component's root DOM element at creation time. This is particularly useful for components like Dialog that wrap themselves in a root element at creation time.
The specified
classandstyleare appended to the current class and style, respectively. All other attributes overwrite any existing value.Setting this option after component creation has no effect.
- Default Value:
undefined
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 77
Example
Initialize a JET component, specifying a set of attributes to be set on the component's root DOM element:
$( ".selector" ).ojFoo({ "rootAttributes": { 'id': 'myId', 'style': 'max-width:100%; color:blue;', 'class': 'my-class' }}); -
#tail :string
-
Determines if a decoration will be displayed from the popup that points to the element the popup is aligned to. The
simplevalue enables the tail defined by the current theme. In addtion, theoj-popup-tail-simpleselector will be applied to the root dom element. This is to allow the box-shadow, z-index and other chrome styling to vary per tail decoration.- Default Value:
"none"
- Source:
- ojpopup/ojpopup.js, line 378
Supported Values:
Name Type Description "none"string no decoration will be displayed from the popup pointing to the launcher. "simple"string enables showing the tail defined by the current theme. Examples
Initialize the popup with
tailoption specified:$( ".selector" ).ojPopup( { "tail": "simple" } );Get or set the
tailoption, after initialization:// getter var tail = $( ".selector" ).ojPopup( "option", "tail" ); // setter $( ".selector" ).ojPopup( "option", "tail", "simple" );
Events
-
#beforeClose
-
Triggered before the popup is dismissed via the
close()method. The close can be cancelled by callingevent.preventDefault().- Source:
- ojpopup/ojpopup.js, line 439
Properties:
Name Type Description eventEvent jQueryevent objectuiObject dom element that the popup was bound to Examples
Initialize the popup with the
beforeClosecallback specified:$( ".selector" ).ojPopup({ "beforeClose": function( event, ui ) {} });Bind an event listener to the
ojbeforecloseevent:$( ".selector" ).on( "ojbeforeclose", function( event, ui ) {} ); -
#beforeOpen
-
Triggered before the popup is launched via the
open()method. The launch can be cancelled by callingevent.preventDefault().- Source:
- ojpopup/ojpopup.js, line 400
Properties:
Name Type Description eventEvent jQueryevent objectuiObject dom element that the popup was bound to Examples
Initialize the popup with the
beforeOpencallback specified:$( ".selector" ).ojPopup({ "beforeOpen": function( event, ui ) {} });Bind an event listener to the
ojbeforeopenevent:$( ".selector" ).on( "ojbeforeopen", function( event, ui ) {} ); -
#close
-
Triggered after the popup is dismissed via the
close()method.- Source:
- ojpopup/ojpopup.js, line 458
Properties:
Name Type Description eventEvent jQueryevent objectuiObject dom element that the popup was bound to Examples
Initialize the popup with the
closecallback specified:$( ".selector" ).ojPopup({ "close": function( event, ui ) {} });Bind an event listener to the
ojcloseevent:$( ".selector" ).on( "ojclose", function( event, ui ) {} ); -
#focus
-
Triggered after focus has been transfered to the popup. This will occur after the
open()method is called, depending on the value of theinitialFocusoption. It's also triggered when using the F6 key to toggle focus from the associated launcher element to the content of the popup.- Source:
- ojpopup/ojpopup.js, line 480
Properties:
Name Type Description eventEvent jQueryevent objectuiObject dom element that the popup was bound to Examples
Initialize the popup with the
focuscallback specified:$( ".selector" ).ojPopup({ "focus": function( event, ui ) {} });Bind an event listener to the
ojfocusevent:$( ".selector" ).on( "ojfocus", function( event, ui ) {} ); -
#open
-
Triggered after the popup is launched via the
open()method.- Source:
- ojpopup/ojpopup.js, line 419
Properties:
Name Type Description eventEvent jQueryevent objectuiObject dom element that the popup was bound to Examples
Initialize the popup with the
opencallback specified:$( ".selector" ).ojPopup({ "open": function( event, ui ) {} });Bind an event listener to the
ojopenevent:$( ".selector" ).on( "ojopen", function( event, ui ) {} );
Methods
-
#close() → {void}
-
Closes the popup. This method does not accept any arguments.
- Source:
- ojpopup/ojpopup.js, line 628
Fires:
Returns:
- Type
- void
Example
Invoke the
closemethod:var close = $( ".selector" ).ojPopup( "close" ); -
#getNodeBySubId(locator) → {Element|null}
-
Return the subcomponent node represented by the documented locator attribute values.
Parameters:
Name Type Description locatorObject An Object containing at minimum a subId property whose value is a string, documented by the component, that allows the component to look up the subcomponent associated with that string. It contains: component: optional component name - in the future there may be more than one component contained within a page element
subId: the string, documented by the component, that the component expects in getNodeBySubId to locate a particular subcomponent.
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 526
Returns:
the subcomponent located by the subId string passed in locator, if found.- Type
- Element | null
-
#getSubIdByNode(node) → {string|null}
-
Return the subId string for the given child DOM node
Parameters:
Name Type Description nodeElement child DOM node - Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 548
Returns:
- the subId for the DOM node or null when none is found- Type
- string | null
-
#isOpen() → {boolean}
-
Returns the state of whether the popup is currently open. This method does not accept any arguments.
- Source:
- ojpopup/ojpopup.js, line 683
Returns:
trueif the popup is open.- Type
- boolean
Example
Invoke the
isOpenmethod:var isOpen = $( ".selector" ).ojPopup( "isOpen" ); -
#open(launcher, position) → {void}
-
Opens the popup. This method accepts two arguments but both are optional.
Parameters:
Name Type Argument Description launcherstring | jQuery | Element <nullable>
of the popup positionObject <nullable>
an element relative to another - Source:
- ojpopup/ojpopup.js, line 548
Fires:
Returns:
- Type
- void
Example
Invoke the
openmethod:var open = $( ".selector" ).ojPopup( "open" ); -
#option(optionName, value) → {Object|undefined}
-
This method has several overloads, which gets and set component options.
The first overload accepts a single
optionNameparam as a string, and returns the current value of that option.The second overload accepts two params, an
optionNamestring and a new value to which that option will be set.The third overload accepts no params, and returns a map of key/value pairs representing all the component options and their values.
The fourth overload accepts a single map of option-value pairs to set on the component.
Parameters:
Name Type Argument Description optionNamestring | Object <optional>
the option name (string, first two overloads), or the map (Object, last overload). Omitted in the third overload. valueObject <optional>
a value to set for the option. Second overload only. - Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 600
Returns:
The getter overloads return the retrieved value(s). When called via the public jQuery syntax, the setter overloads return the object on which they were called, to facilitate method chaining.- Type
- Object | undefined
Examples
First overload: get one option:
var isDisabled = $( ".selector" ).ojFoo( "option", "disabled" ); // Foo is Button, Menu, etc.Second overload: set one option:
$( ".selector" ).ojFoo( "option", "disabled", true ); // Foo is Button, Menu, etc.Third overload: get all options:
var options = $( ".selector" ).ojFoo( "option" ); // Foo is Button, Menu, etc.Fourth overload: set one or more options:
$( ".selector" ).ojFoo( "option", { disabled: true } ); // Foo is Button, Menu, etc. -
#refresh()
-
Refreshes the widget.
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 87
Non-public Methods
-
<protected> #_AfterCreate()
-
This method is called after
_ComponentCreate. The JET base component does tasks here that must happen after the component (subclass) has created itself in its override of_ComponentCreate. Notably, the base component handles therootAttributesandcontextMenuoptions here, since those options operate on the component root node, which for some components is created in their override of_ComponentCreate.Subclasses should override this method only if they have tasks that must happen after a superclass's implementation of this method, e.g. tasks that must happen after the context menu is set on the component.
Overrides of this method should call
this._superfirst.- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 292
-
<protected> #_ComponentCreate() → {void}
-
- Source:
- ojpopup/ojpopup.js, line 489
Returns:
- Type
- void
-
<protected> #_destroy() → {void}
-
- Source:
- ojpopup/ojpopup.js, line 518
Returns:
- Type
- void
-
<protected> #_GetReadingDirection() → {string}
-
Determines whether the component is LTR or RTL.
Component responsibilities:
- All components must determine directionality exclusively by calling this protected superclass method. (So that any future updates to the logic can be made in this one place.)
- Components that need to know the directionality must call this method from
_create()andrefresh(), and cache the value. - Components should not call this at other times, and should instead use the cached value. (This avoids constant DOM queries, and avoids any future issues if directional islands and component reparenting (e.g. popups) should coexist.)
App responsibilities:
- The app specifies directionality by setting the HTML
"dir"attribute on the<html>node. When omitted, the default is"ltr". (Per-component directionality / directional islands are not currently supported due to inadequate CSS support.) - As with any DOM change, the app must
refresh()the component if the directionality changes dynamically. (This provides a hook for component housekeeping, and allows caching.)
- Default Value:
"ltr"
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 888
Returns:
the reading direction, either"ltr"or"rtl"- Type
- string
-
<protected> #_GetSavedAttributes(element) → {Object}
-
Gets the saved attributes for the provided element. This is usually the original list of attributes set on the element.
Parameters:
Name Type Description elementObject jQuery selection, should be a single entry - Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 359
Returns:
savedAttributes - attributes that were saved for this element.- Type
- Object
-
<protected> #_InitOptions()
-
This method is called before
_ComponentCreate, at which point the component has not yet been rendered. Component options should be initialized in this method, so that their final values are in place when_ComponentCreateis called.This includes getting option values from the DOM, where applicable, and coercing option values (however derived) to their appropriate data type. No other work should be done in this method. See below for details.
Overrides of this method should call
this._superfirst.Usage:
- If the component has an option like
disabledthat can be set from the DOM at create time, then the "get from DOM" logic should live in this method. E.g. a typical override might say "if thedisabledoption still has its initial value ofundefined(i.e., the option has not been set), then get the DOM property and set it on the option." (See also next bullet.) - For attributes that live on the component's root node, keep in mind that anything specified via
the
rootAttributesoption will not be placed on the DOM until_AfterCreate. So when getting attributes from the root node, components must first look in therootAttributesoption, and then, only if the attribute is not found there, look on the component root (if it already exists). - For options that, unlike
disabled, have no corresponding DOM property, and are not otherwise set from the DOM, there is nothing to do in this method. - Do NOT set anything on the DOM in this method (like the resolved
disabledvalue, or anyrootAttributesvalues). The resolved option values should be set on the DOM later, in_ComponentCreate, and therootAttributesvalues are set inbaseComponent._AfterCreate.
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 249
- If the component has an option like
-
<protected> #_RestoreAttributes()
-
Restores the saved element's attributes
- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 385
-
<protected> #_SaveAttributes(element)
-
Saves the element's attributes within an internal variable to be reset during the destroy function The JSON variable will be held as : [ { "element" : element[i], "attributes" : { attributes[m]["name"] : {"attr": attributes[m]["value"], "prop": $(element[i]).prop(attributes[m]["name"]) } } ]
Parameters:
Name Type Description elementObject jQuery selection to save attributes for - Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 320
-
<protected> #_setOption(key, value)
-
Parameters:
Name Type Argument Description keystring option name valueObject <nullable>
of the target option identified by the key - Source:
- ojpopup/ojpopup.js, line 708
-
<protected> #_SetRootAttributes()
-
Reads the
rootAttributesoption, and sets the root attributes on the component's root DOM element.classandstyleare appended to the current class and style, respectively. All other attributes overwrite any existing value.- Inherited From:
- Source:
- ojcomponentcore/jqueryui-base.js, line 103