Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Slots
JET elements can have up to two types of child content:
- Any child element with a
slotattribute will be moved into that named slot, e.g.<span slot='startIcon'>...</span>. All supported named slots are documented below. Child elements with unsupported named slots will be removed from the DOM. - Any child element lacking a
slotattribute will be moved to the default slot, also known as a regular child.
-
contextMenu
-
The contextMenu slot is set on the
oj-menuwithin this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.
To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc and demos of the individual components for details.
Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.
Example
Initialize the component with a context menu:
<oj-some-element> <-- use the contextMenu slot to designate this as the context menu for this component --> <oj-menu slot="contextMenu" style="display:none" aria-label="Some element's context menu"> ... </oj-menu> </oj-some-element>
Attributes
-
(nullable) described-by :string
-
It is used to establish a relationship between this component and another element. Typically this is not used by the application developer, but by the oj-label custom element's code. One use case is where the oj-label custom element code writes described-by on its form component for accessibility reasons. To facilitate correct screen reader behavior, the described-by attribute is copied to the aria-describedby attribute on the component's dom element.
- Since:
- 4.0.0
Names
Item Name Property describedByProperty change event describedByChangedProperty change listener attribute (must be of type function) on-described-by-changedExamples
Initialize component with the
described-byattribute specified:<oj-some-element described-by="someId"></oj-some-element>Get or set the
describedByproperty after initialization:// getter var descById = myComp.describedBy; // setter myComp.describedBy = "someId"; -
disabled :boolean
-
Whether the component is disabled. The default is false.
When the
disabledproperty changes due to programmatic intervention, the component may clear messages and run validation in some cases.
- when a required component is initialized as disabled
value="{{currentValue}}" required disabled, deferred validation is skipped. - when a disabled component is enabled,
- if component is invalid and showing messages then all component messages are cleared,
and full validation run using the display value.
- if there are validation errors, they are shown.
- if no errors result from the validation, the
valueproperty is updated. Page authors can listen to theonValueChangedevent to clear custom errors.
- if component is valid and has no errors then deferred validation is run.
- if there is a deferred validation error, then the valid property is updated.
- if component is invalid and deferred errors then component messages are cleared and
deferred validation re-run.
- if there is a deferred validation error, then the valid property is updated.
- if component is invalid and showing messages then all component messages are cleared,
and full validation run using the display value.
- when enabled component is disabled then no validation is run and the component appears disabled.
- Default Value:
false
- Since:
- 0.7
Names
Item Name Property disabledProperty change event disabledChangedProperty change listener attribute (must be of type function) on-disabled-changedExamples
Initialize component with
disabledattribute:<oj-some-element disabled></oj-some-element>Get or set the
disabledproperty after initialization:// getter var disabled = myComp.disabled; // setter myComp.disabled = false; - when a required component is initialized as disabled
-
display-options :Object
-
Display options for auxilliary content that determines where it should be displayed in relation to the component.
The types of messaging content for which display options can be configured include
converterHint,helpInstruction,messages, andvalidatorHint.
The display options for each type is specified either as an array of strings or a string. When an array is specified the first display option takes precedence over the second and so on.When display-options changes due to programmatic intervention, the component updates its display to reflect the updated choices. For example, if 'help.instruction' property goes from 'notewindow' to 'none' then it no longer shows in the notewindow.
A side note: help.instruction and message detail text can include formatted HTML text, whereas hints and message summary text cannot. If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there. To format the help.instruction, you could do this:
<html>Enter <b>at least</b> 6 characters</html>- Since:
- 0.7
Names
Item Name Property displayOptionsProperty change event displayOptionsChangedProperty change listener attribute (must be of type function) on-display-options-changedExamples
Override default values for
display-optionsfor one component:// In this example, the display-options are changed from the defaults. // The 'converterHint' is none, the 'validatorHint' is none and the 'helpInstruction' is none, // so only the 'messages' will display in its default state. // <oj-some-element display-options='{"converterHint": "none", "validatorHint": "none", "helpInstruction": "none"}'></oj-some-element>Get or set the
displayOptionsproperty after initialization:// Get one subproperty var hint = myComp.displayOptions.converterHint; // Set one, leaving the others intact. Use the setProperty API for // subproperties so that a property change event is fired. myComp.setProperty("displayOptions.converterHint", "none"); // get all var options = myComp.displayOptions; // set all. Must list every resource key, as those not listed are lost. myComp.displayOptions = {converterHint: "none", validatorHint: "none", helpInstruction: "none"}; -
display-options.converter-hint :(Array.<('placeholder'|'notewindow'|'none')>|'placeholder'|'notewindow'|'none')
-
Display options for auxilliary converter hint text that determines where it should be displayed in relation to the component. When there is already a placeholder set on the component, the converter hint falls back to display type of 'notewindow'.
- Default Value:
['placeholder','notewindow']
- Since:
- 0.7
Names
Item Name Property displayOptions.converterHint -
display-options.help-instruction :(Array.<('notewindow'|'none')>|'notewindow'|'none')
-
Display options for auxilliary help instruction text that determines where it should be displayed in relation to the component.
- Default Value:
['notewindow']
- Since:
- 0.7
Names
Item Name Property displayOptions.helpInstruction -
display-options.messages :(Array.<('inline'|'notewindow'|'none')>|'inline'|'notewindow'|'none')
-
Display options for auxilliary message text that determines where it should be displayed in relation to the component.
- Default Value:
['inline']
- Since:
- 0.7
Names
Item Name Property displayOptions.messages -
display-options.validator-hint :(Array.<('notewindow'|'none')>|'notewindow'|'none')
-
Display options for auxilliary validator hint text that determines where it should be displayed in relation to the component.
- Default Value:
['notewindow']
- Since:
- 0.7
Names
Item Name Property displayOptions.validatorHint -
help :Object
-
Form component help information.
The properties supported on the
helpoption are:- Since:
- 0.7
Properties:
Name Type Argument Description instructionstring <optional>
this represents advisory information for the component The default value is null.Names
Item Name Property helpProperty change event helpChangedProperty change listener attribute (must be of type function) on-help-changed -
help.instruction :string
-
Represents advisory information for the component, such as would be appropriate for a tooltip.
When help.instruction is present it is by default displayed in the notewindow, or as determined by the 'helpInstruction' property set on the
displayOptionsattribute. When thehelp.instructionproperty changes the component refreshes to display the updated information.JET takes the help instruction text and creates a notewindow with the text. The help instruction only shows up as a tooltip on mouse over, not on keyboard and not in a mobile device. So help instruction would only be for text that is not important enough to show all users, or for text that you show the users in another way as well, like in the label. Also you cannot theme the native browser's title window like you can the JET notewindow, so low vision users may have a hard time seeing it. For these reasons, the JET EditableValue components do not use the HTML's title attribute.
To include formatted text in the help.instruction, format the string using html tags. For example the help.instruction might look like:
If you use formatted text, it should be accessible and make sense to the user if formatting wasn't there.<oj-some-element help.instruction="<html>Enter <b>at least</b> 6 characters</html>"></oj-some-element>- Default Value:
""
- Since:
- 4.0.0
Names
Item Name Property help.instructionExamples
Initialize the component with the
help.instructionsub-attribute:<oj-some-element help.instruction="some tooltip"></oj-some-element>Get or set the
help.instructionproperty after initialization:// Get one subproperty var instr = myComp.help.instruction; // Set one subproperty, leaving the others intact. Use the setProperty API for // subproperties so that a property change event is fired. myComponent.setProperty('help.instruction', 'some new value'); // Get all var values = myComponent.help; // Set all. Must list every resource key, as those not listed are lost. myComponent.help = { instruction: 'some new value' }; -
help-hints :Object
-
Represents hints for oj-form-layout element to render help information on the label of the editable component.
This is used only if the editable component is added as a direct child to an oj-form-layout element, and the labelHint property is also specified.
The helpHints object contains a definition property and a source property.
definition- hint for help definition text.source- hint for help source URL.
- Since:
- 4.1.0
Names
Item Name Property helpHintsProperty change event helpHintsChangedProperty change listener attribute (must be of type function) on-help-hints-changedExamples
Initialize the component with help hints:
<!-- Using dot notation --> <oj-some-element help-hints.definition='some value' help-hints.source='some-url'></oj-some-element> <!-- Using JSON notation --> <oj-some-element help-hints='{"definition":"some value", "source":"some-url"}'></oj-some-element>Get or set the
helpHintsproperty after initialization:// Get one var value = myComponent.helpHints.definition; // Set one, leaving the others intact. Always use the setProperty API for // subproperties rather than setting a subproperty directly. myComponent.setProperty('helpHints.definition', 'some new value'); // Get all var values = myComponent.helpHints; // Set all. Must list every subproperty, as those not listed are lost. myComponent.helpHints = { definition: 'some new value', source: 'some-new-url' }; -
help-hints.definition :string
-
Hint for help definition text associated with the label.
It is what shows up when the user hovers over the help icon, or tabs into the help icon, or press and holds the help icon on a mobile device. No formatted text is available for help definition attribute.
See the help-hints attribute for usage examples.
- Default Value:
""
- Since:
- 4.1.0
Names
Item Name Property helpHints.definition -
help-hints.source :string
-
Hint for help source URL associated with the label.
If present, a help icon will render next to the label. For security reasons we only support urls with protocol http: or https:. If the url doesn't comply we ignore it and throw an error. Pass in an encoded URL since we do not encode the URL.
See the help-hints attribute for usage examples.
- Default Value:
""
- Since:
- 4.1.0
Names
Item Name Property helpHints.source -
label-display :string
-
Specifies whether a text label accompanies the color swatch.
- Default Value:
"off"
Supported Values:
Name Type Description "auto"string labels are displayed if the layout property is 'list' and swatch-size is 'sm' or if the layout is 'grid' and swatch-size is 'lg' "off"string labels are not displayed Names
Item Name Property labelDisplayProperty change event labelDisplayChangedProperty change listener attribute (must be of type function) on-label-display-changedExamples
Initialize the color palette with the
label-displayattribute specified:<oj-color-palette label-display="auto"></oj-color-palette>Get or set the
labelDisplayproperty, after initialization:// getter var labelDisplay = myColorPalette.labelDisplay; // setter myColorPalette.labelDisplay = "auto"; -
label-hint :string
-
Represents a hint for oj-form-layout element to render a label on the editable component.
This is used only if the editable component is added as a direct child to an oj-form-layout element.
When labelHint is present it gives a hint to the oj-form-layout element to create an oj-label element for the editable component. When the
labelHintproperty changes oj-form-layout element refreshes to display the updated label information.- Default Value:
""
- Since:
- 4.1.0
Names
Item Name Property labelHintProperty change event labelHintChangedProperty change listener attribute (must be of type function) on-label-hint-changedExamples
Initialize the component with the
label-hintattribute specified:<oj-some-element label-hint='input label'></oj-some-element>Get or set the
labelHintproperty after initialization:// getter var value = myComponent.labelHint; // setter myComponent.labelHint = 'some new value' -
(nullable) labelled-by :string
-
Labelled-by is used to establish a relationship between this and another element. A common use is to tie the oj-label and the oj-color-palette together. The oj-label custom element has an id, and you use the labelled-by attribute to tie the two elements together.
- Default Value:
null
Names
Item Name Property labelledByProperty change event labelledByChangedProperty change listener attribute (must be of type function) on-labelled-by-changedExamples
Initialize the color palette with the
labelled-byattribute specified:<oj-label id="labelId">Name:</oj-label> <oj-color-palette labelled-by="labelId"></oj-color-palette>Get or set the
labelled-byproperty, after initialization:// getter var labelledBy = myColorPalette.labelledBy; // setter myColorPalette.labelledBy = "labelId"; -
layout :string
-
Specifies the layout of the color swatches.
- Default Value:
"grid"
Supported Values:
Name Type Description "grid"string Layout the color swatches in a grid "list"string Layout the color swatches in a list Names
Item Name Property layoutProperty change event layoutChangedProperty change listener attribute (must be of type function) on-layout-changedExamples
Initialize the color palette with the
layoutattribute specified:<oj-color-palette layout="grid"></oj-color-palette>Get or set the
layoutproperty, after initialization:// getter var layout = myColorPalette.layout; // setter myColorPalette.layout = "grid"; -
messages-custom :Array.<Object>
-
List of messages an app would add to the component when it has business/custom validation errors that it wants the component to show. This allows the app to perform further validation before sending data to the server. When this option is set the message shows to the user right away. To clear the custom message, set
messagesCustomback to an empty array.
Each message in the array is an object that duck types oj.Message. See oj.Message for details.
See the Validation and Messages section for details on when the component clears
messagesCustom; for example, when full validation is run.- Default Value:
[]
- Supports writeback:
true
- Since:
- 0.7
Names
Item Name Property messagesCustomProperty change event messagesCustomChangedProperty change listener attribute (must be of type function) on-messages-custom-changedExamples
Get or set the
messagesCustomproperty after initialization:// getter var customMsgs = myComp.messagesCustom; // setter myComp.messagesCustom = [{summary:"hello", detail:"detail", severity:oj.Message.SEVERITY_LEVEL.INFO}];Set messagesCustom when there are cross-validation errors:
--- HTML --- <oj-some-element messages-custom='{{messagesCustom}}'></oj-some-element> --- ViewModel code --- self.messagesCustom = ko.observableArray([]); // the app's function that gets called when the user presses the submit button if (!myValidateCrossValidationFields()) { // the app adds a custom messages to the component and it is displayed right away var msgs = []; msgs.push({'summary':'Cross field error', 'detail':'Field 1 needs to be less than Field 2'}); self.messagesCustom(msgs); } else { // submit data to the server } -
palette :Array.<Object>
-
Specify an array of objects defining the palette's color set, and optionally, descriptive labels for the colors. Each object has the following structure:
- Default Value:
null
Properties:
Name Type Argument Description coloroj.Color the color definition labelstring <optional>
optional descriptive string (refer to attribute label-display). If omitted, label defaults to the color's hex string format. Names
Item Name Property paletteProperty change event paletteChangedProperty change listener attribute (must be of type function) on-palette-changedExamples
Initialize the color palette with the
paletteattribute specified:<oj-color-palette palette='[[myPalette]]'></oj-color-palette>Get or set the
paletteproperty, after initialization:// Get one var oneColor = myColorPalette.palette[0]; // Get all var myPallete = myColorPalette.palette; // Set all var palette = [{color:new oj.Color('#ffffff'), label: 'White'}, {color: new oj.Color('#77bb99'), label: 'Std text'}, . . .]; myColorPalette.palette = palette; -
swatch-size :string
-
The swatch size. If the size is 'sm' or 'xs', the color label property is used as a tooltip.
- Default Value:
"lg"
Supported Values:
Name Type Description "lg"string large swatch "sm"string small swatch "xs"string extra small swatch Names
Item Name Property swatchSizeProperty change event swatchSizeChangedProperty change listener attribute (must be of type function) on-swatch-size-changedExamples
Initialize the color palette with the
swatch-sizeattribute specified:<oj-color-palette swatch-size="lg"></oj-color-palette>Get or set the
swatchSizeproperty, after initialization:// getter var swatchSize = myColorPalette.swatchSize; // setter myColorPalette.swatchSize = "lg"; -
translations :Object|null
-
A collection of translated resources from the translation bundle, or
nullif this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.If the component does not contain any translatable resource, the default value of this attribute will be
null. If not, an object containing all resources relevant to the component.If this component has translations, their documentation immediately follows this doc entry.
Names
Item Name Property translationsProperty change event translationsChangedProperty change listener attribute (must be of type function) on-translations-changedExamples
Initialize the component, overriding some translated resources and leaving the others intact:
<!-- Using dot notation --> <oj-some-element translations.some-key='some value' translations.some-other-key='some other value'></oj-some-element> <!-- Using JSON notation --> <oj-some-element translations='{"someKey":"some value", "someOtherKey":"some other value"}'></oj-some-element>Get or set the
translationsproperty after initialization:// Get one var value = myComponent.translations.someKey; // Set one, leaving the others intact. Always use the setProperty API for // subproperties rather than setting a subproperty directly. myComponent.setProperty('translations.someKey', 'some value'); // Get all var values = myComponent.translations; // Set all. Must list every resource key, as those not listed are lost. myComponent.translations = { someKey: 'some value', someOtherKey: 'some other value' }; -
translations.label-none :string
-
Label for swatch with no color.
See the translations attribute for usage examples.
- Default Value:
"None"
Names
Item Name Property translations.labelNone -
(readonly) valid :string
PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.
-
The current valid state of the component. It is evaluated on initial render. It is re-evaluated
- after validation is run (full or deferred)
- when messagesCustom is updated, since messagesCustom can be added by the app developer any time.
- when showMessages() is called. Since showMessages() moves the hidden messages into messages shown, if the valid state was "invalidHidden" then it would become "invalidShown".
- when the required property has changed. If a component is empty and has required set, the valid state may be "invalidHidden" (if no invalid messages are being shown as well). If required property is removed, the valid state would change to "valid".
Note: New valid states may be added to the list of valid values in future releases. Any new values will start with "invalid" if it is an invalid state, "pending" if it is pending state, and "valid" if it is a valid state.
- Supports writeback:
true
- Since:
- 4.2.0
Supported Values:
Name Type Description "invalidHidden"string The component has invalid messages hidden and no invalid messages showing. An invalid message is one with severity "error" or higher. "invalidShown"string The component has invalid messages showing. An invalid message is one with severity "error" or higher. "pending"string The component is waiting for the validation state to be determined. The "pending" state is set at the start of the convert/validate process. "valid"string The component is valid Names
Item Name Property validProperty change event validChangedProperty change listener attribute (must be of type function) on-valid-changedExamples
Get
validattribute, after initialization:// Getter: var valid = myComp.valid;Set the
on-valid-changedlistener so you can do work in the ViewModel based on thevalidproperty:<oj-some-element id='username' on-valid-changed='[[validChangedListener]]'> </oj-some-element> <oj-some-element id='password' on-valid-changed='[[validChangedListener]]'> </oj-some-element> <oj-button disabled='[[componentDisabled]]' on-click='[[submit]]'>Submit</oj-button> -- ViewModel -- self.validChangedListener = function (event) { var enableButton; var usernameValidState; var passwordValidState; // update the button's disabled state. usernameValidState = document.getElementById("username").valid; passwordValidState = document.getElementById("password").valid; // this updates the Submit button's disabled property's observable based // on the valid state of two components, username and password. // It is up to the application how it wants to handle the �pending� state // but we think that in general buttons don�t need to be // enabled / disabled based on the "pending" state. enableButton = (usernameValidState !== "invalidShown") && (passwordValidState !== "invalidShown"); self.componentDisabled(!enableButton);; }; -
value :oj.Color
-
The current value of the palette element.
- Default Value:
null
- Supports writeback:
true
Names
Item Name Property valueProperty change event valueChangedProperty change listener attribute (must be of type function) on-value-changedExamples
Initialize the color palette with the
valueattribute specified:<oj-color-palette value='{{myColor}}'></oj-color-palette>Get or set the
valueproperty, after initialization:// getter var color = myColorPalette.value; // setter myColorPalette.value = new oj.Color('rgb(0,0,0)');
Events
-
ojAnimateEnd
-
Triggered when a default animation has ended.
- "inline-open" - when an inline message container opens or increases in size
- "inline-close" - when an inline message container closes or decreases in size
- "notewindow-open" - when a note window opens
- "notewindow-close" - when a note window closes
- Since:
- 4.0.0
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description actionstring The action that triggers the animation. Supported values are: elementElement The element being animated. Examples
Define an event listener for the
ojAnimateEndevent to add any processing after the end of "inline-open" animation:var listener = function( event ) { // Check if this is the end of "inline-open" animation for inline message if (event.detail.action == "inline-open") { // Add any processing here } };Specify an
ojAnimateEndlistener via the DOM attribute:<oj-color-palette on-oj-animate-end='[[listener]]'></oj-color-palette>Specify an
ojAnimateEndlistener via the JavaScript property:myColorPalette.onOjAnimateEnd = listener;Add an
ojAnimateEndlistener via theaddEventListenerAPI:myColorPalette.addEventListener('ojAnimateEnd', listener); -
ojAnimateStart
-
Triggered when a default animation is about to start on an element owned by the component.
The default animation can be cancelled by calling
event.preventDefault, followed by a call toevent.detail.endCallback.event.detail.endCallbackshould be called immediately afterevent.preventDefaultif the application merely wants to cancel animation, or it should be called when the custom animation ends if the application is invoking another animation function. Failure to callevent.detail.endCallbackmay prevent the component from working properly.For more information on customizing animations, see the documentation of oj.AnimationUtils.
The default animations are controlled via the theme (SCSS) : // default animations for "notewindow" display option $noteWindowOpenAnimation: (effect: "zoomIn", transformOrigin: "#myPosition") !default; $noteWindowCloseAnimation: (effect: "none") !default; // default animations for "inline" display option $messageComponentInlineOpenAnimation: (effect: "expand", startMaxHeight: "#oldHeight") !default; $messageComponentInlineCloseAnimation: (effect: "collapse", endMaxHeight: "#newHeight") !default;- "inline-open" - when an inline message container opens or increases in size
- "inline-close" - when an inline message container closes or decreases in size
- "notewindow-open" - when a note window opens
- "notewindow-close" - when a note window closes
- Since:
- 4.0.0
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description actionstring The action that triggers the animation. Supported values are: elementElement The element being animated. endCallbackfunction():void If the event listener calls event.preventDefault to cancel the default animation, it must call the endCallback function when it finishes its own animation handling and any custom animation has ended. Examples
Define an event listener for the
ojAnimateStartevent to override the default "inline-open" animation:var listener = function( event ) { // Change the "inline-open" animation for inline message if (event.detail.action == "inline-open") { // Cancel default animation event.preventDefault(); // Invoke new animation and call endCallback when the animation ends oj.AnimationUtils.fadeIn(event.detail.element).then(event.detail.endCallback); } };Define an event listener for the
ojAnimateStartevent to cancel the default "notewindow-close" animation:var listener = function( event ) { // Change the "notewindow-close" animation for note window if (ui.action == "notewindow-close") { // Cancel default animation event.preventDefault(); // Call endCallback immediately to indicate no more animation event.detail.endCallback(); };Specify an
ojAnimateStartlistener via the DOM attribute:<oj-color-palette on-oj-animate-start='[[listener]]'></oj-color-palette>Specify an
ojAnimateStartlistener via the JavaScript property:myColorPalette.onOjAnimateStart = listener;Add an
ojAnimateStartlistener via theaddEventListenerAPI:myColorPalette.addEventListener('ojAnimateStart', listener);
Methods
-
getProperty(property) → {any}
-
Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. Returns:
- Type
- any
Example
Get a single subproperty of a complex property:
var subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
refresh() → {void}
-
Called when the DOM underneath the component changes requiring a re-render of the component. An example is when the
idfor the input changes.
Another time when refresh might be called is when the locale for the page changes. When it changes, attributes used by its converter and validator that are locale specific, its hints, messages and translations will be updated.
When
refreshmethod is called, the component may take various steps such as clearing messages, running validation etc., based on the state it is in.
Steps Performed Always
- The converter and validators used by the component are reset, and new converter and validator hints is pushed to messaging. E.g., notewindow displays the new hint(s).
Running Validation
- if component is valid when refresh() is called, the display value is refreshed if component has a converter set.
- if component is invalid and is showing messages when
refresh()is called, then all component messages are cleared and full validation run using the display value on the component.- if there are validation errors, then
valueattribute is not updated and the error is shown. - if no errors result from the validation, the
valueattribute is updated; page author can listen to theonValueChangedevent to clear custom errors.
- if there are validation errors, then
- if component is invalid and has deferred messages when
refresh()is called, then all component messages are cleared and deferred validation is run.
Clearing Messages
- If clearing messages only those created by the component are cleared.
messagesCustomattribute is not cleared.
- Since:
- 0.7
Returns:
- Type
- void
Example
Redraw the component element.
myComp.refresh(); -
reset() → {void}
-
Resets the component by clearing all messages and messages attributes -
messagesCustom- and updates the component's display value using the attribute value. User entered values will be erased when this method is called.- Since:
- 0.7
Returns:
- Type
- void
Example
Reset component
myComp.reset(); -
setProperties(properties)
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. Example
Set a batch of properties:
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"}); -
setProperty(property, value)
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Example
Set a single subproperty of a complex property:
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue"); -
showMessages() → {void}
-
Takes all deferred messages and shows them. It then updates the valid property; e.g., if the valid state was "invalidHidden" before showMessages(), the valid state will become "invalidShown" after showMessages().
If there were no deferred messages this method simply returns.
- Since:
- 0.7
Returns:
- Type
- void
Example
Display all messages including deferred ones.
myComp.showMessages();