Element: <oj-form-layout>

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class ojFormLayout

QuickNav

Attributes

JET Custom Elements

JET components are implemented as custom HTML elements. In addition to the component attributes documented in this page, JET components also support standard HTML global attributes like id and aria-label.

The JET data binding syntax can be used to define both component and global attributes through the use of dynamically evaluated expressions. All attributes (component and global) support attribute-level binding by prefixing the attribute name with ":" (e.g. :id="[...]"). When using attribute-level binding, all expression values are treated as strings. Additionally, component attributes support property-level binding by using the attribute name directly with no ":" prefix. When using property-level binding, the expressions should evaluate to the types documented by the corresponding attributes. Property-level binding is strongly recommended over attribute-level binding for component attributes.

A detailed description of working with custom HTML elements can be found in: JET Custom Element Usage.



PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

Version:
  • 7.1.0
Since:
  • 4.1.0
Module:
  • ojformlayout

Module usage

See JET Module Loading for an overview of module usage within JET.

Typescript Import Format
//To typecheck the element APIs, import as below.
import {ojFormLayout} from "ojs/ojformlayout";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojformlayout";

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.


JET FormLayout

The oj-form-layout element is used to layout groups of label/value pairs in an organized layout that can be optimized for multiple display sizes via attribute value settings. The following describes how child elements are handled:

- The following JET components have a label-hint attribute that allows them to be treated as a label/value pair with an oj-label element dynamically created from the label-hint and help-hints:
oj-checkboxset, oj-color-palette, oj-color-spectrum, oj-input-date, oj-input-date-time, oj-input-time, oj-input-number, oj-input-text, oj-text-area, oj-input-password, oj-combobox-one, oj-combobox-many, oj-radioset, oj-select-one, oj-select-many, oj-slider, oj-switch
- An oj-label element, followed by any element. The oj-label element will be in the label area and the next element will be in the value area
- An oj-label-value child component allows the developer to place elements in the label and/or value area as 'label' and 'value' slot chilren.
- All other elements will span the entire width of a single label/value pair. To have a form element span multiple columns, add an oj-label-value component as a child of the oj-form-layout add the component that you want to span multiple columns as a child of the oj-label-value. The colspan attribute on the oj-label-value is used to specify the number of columns to span, and the direction attribute on the oj-form-layout must be set to "row". NOTE: To minimize the need for adding a style attribute to achieve a max-width of 100% on the column spanning component and to facilitate start and end field alignment, the default max-width for form controls is changed to 100% when all of the following conditions are met: - direction == "row" - max-columns > 1 - there is at least one oj-label-value child with a colspan attribute specified.

For example:


<oj-form-layout max-columns='2' label-edge='start' label-width="50%">
  <oj-input-text id="inputcontrol" required value="text" label-hint="input 1"></oj-input-text>
  <oj-text-area id="textareacontrol" value='text' rows="6" label-hint="textarea"></oj-text-area>
  <oj-input-text id="inputcontrol2" value="text" label-hint="input 2"></oj-input-text>
  <oj-input-text id="inputcontrol3" value="text" label-hint="input 3 longer label"></oj-input-text>
  <oj-label>oj-label in label area</oj-label>
  <p>Next element in value area</p>
  <oj-label-value id="labelonly">
    <p slot="label">Some text in the label area</p>
  </oj-label-value>
  <oj-label-value id="valueonly">
    <p slot="value">Some text in the value area</p>
  </oj-label-value>
  <p>Some text that spans the label/value area</p>
</oj-form-layout>

The oj-form-layout element currently supports custom element children that support the label-hint and help-hints attributes (oj-input-text, oj-text-area, etc.). For each custom element child with label-hint, FormLayout will generate an oj-label element and pair them together in the layout.

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 components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

Default

The <oj-form-layout> element only accepts element children in the Default slot. Content in <oj-form-layout>'s Default slot will be laid out in a row/column style form layout.

Since:
  • 4.1.0

Attributes

direction :"column"|"row"

Specifies the layout direction of the form layout children.
Supported Values:
Value Description
"column" Components are laid out in columns
"row" Components are laid out in rows
Default Value:
  • "column"
Names
Item Name
Property direction
Property change event directionChanged
Property change listener attribute (must be of type function) on-direction-changed

label-edge :"start"|"top"

Specifies how the label is aligned with its editable value component.
Supported Values:
Value Description
"start" Label is inline with the start of its editable value component
"top" Label is on top of its editable value component
Default Value:
  • "top"
Names
Item Name
Property labelEdge
Property change event labelEdgeChanged
Property change listener attribute (must be of type function) on-label-edge-changed

label-width :string

Specifies the label width.

This specifies the width of the oj-label elements. This can be any legal CSS width.

Default Value:
  • "33%"
Names
Item Name
Property labelWidth
Property change event labelWidthChanged
Property change listener attribute (must be of type function) on-label-width-changed

label-wrapping :"truncate"|"wrap"

Specifies if the label text should wrap or truncate.
Supported Values:
Value Description
"truncate" Label will trunctate if needed
"wrap" Label will wrap if needed
Default Value:
  • "wrap"
Names
Item Name
Property labelWrapping
Property change event labelWrappingChanged
Property change listener attribute (must be of type function) on-label-wrapping-changed

max-columns :number

Specifies the maximum number of columns. The actual number of columns may be less, depending on the direction attribute.

If direction is "column", the layout is responsive and browsers automatically reduce the number of columns to fit the width of the viewport.

If direction is "row", the number of columns is fixed to the max-columns value. Applications can choose to make it responsive by using ResponsiveKnockoutUtils to adjust the value. See the oj-form-layout - Across demo for an example.

Default Value:
  • 1
Names
Item Name
Property maxColumns
Property change event maxColumnsChanged
Property change listener attribute (must be of type function) on-max-columns-changed

Methods

getProperty(property) → {any}

Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Returns:
Type
any

refresh() → {void}

Refreshes the visual state of the component.
Returns:
Type
void

setProperties(properties) → {void}

Performs a batch set of properties.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Returns:
Type
void

setProperty(property, value) → {void}

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
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Returns:
Type
void