Class TypedModel<T, C>

A strictly typed wrapper of a UI5 JSON model.

Type Parameters

  • T extends object

    The type of the model data.

  • C extends object | undefined = undefined

    The type of the context data or undefined if there's no context.

Hierarchy

  • TypedModel

Constructors

  • Constructor for a new TypedModel with the given data.

    Type Parameters

    • T extends object

    • C extends undefined | object = undefined

    Parameters

    • data: T

      The data with which the model will be initialized.

    Returns TypedModel<T, C>

  • Constructor for a new TypedModel based on an existing model and context.

    Type Parameters

    • T extends object

    • C extends undefined | object = undefined

    Parameters

    • model: default

      An existing JSONModel.

    • Optional context: Exclude<C, undefined> extends never
          ? undefined
          : default

      An existing Context.

      Optional

    Returns TypedModel<T, C>

Properties

context: Exclude<C, undefined> extends never
    ? undefined
    : default

The context if exists.

model: default

The underlying JSONModel.

Methods

  • Creates a new aggregation binding info object.

    Type Parameters

    • U extends object

    • O extends default

    Parameters

    • path: string | PathBuilder<T, C, U[]>

      The path to the array property.

    • factory: ((id, model) => O)

      The factory function which returns a new UI5 Control with the given id.

        • (id, model): O
        • Parameters

          Returns O

    • Optional opts: Omit<AggregationBindingInfo, "path" | "template" | "factory">

      The binding options.

      Optional

    Returns TypedAggregationBindingInfo<O>

  • Binds this model to the given object with the given name.

    Parameters

    • obj: {
          setModel(model, name?) => void;
      }

      The UI5 object to bind to.

      • setModel:function
        • Parameters

          • model: default
          • Optional name: string
            Optional

          Returns void

    • Optional name: string

      The name of the model which must be a non-empty string or undefined.

      Optional

    Returns TypedModel<T, C>

  • Creates a new TypedModel with context based on the given path.

    Type Parameters

    • U extends undefined | object

    Parameters

    • path: string | PathBuilder<T, C, U>

      The property path for the context.

    Returns TypedModel<T, U>

  • Returns the value for the property with the given path.

    Type Parameters

    • U

    Parameters

    • path: string | PathBuilder<T, C, U>

      The path to the property.

    Returns U

  • Transforms the given path in dot-notation into a path in slash-notation.

    Type Parameters

    • U

    Parameters

    • path: string | PathBuilder<T, C, U>

      The path in dot-notation.

    Returns string

  • Refreshes the model.

    This will check all bindings for updated data and update the controls if data has been changed.

    Parameters

    • Optional force: boolean

      Update controls even if data has not been changed.

      Optional

    Returns TypedModel<T, C>

  • Sets the value for the property with the given path.

    Type Parameters

    • P extends string | ((data) => PathType<unknown>) | ((data, context) => PathType<unknown>)

    Parameters

    • path: P

      The path to the property.

    • value: P extends PathBuilder<T, C, U>
          ? U
          : never

      The new value to be set for this property.

    • Optional asyncUpdate: boolean

      Whether to update other bindings dependent on this property asynchronously.

      Optional

    Returns TypedModel<T, C>

  • Sets the data of the model.

    Parameters

    • data: T

      The data to set.

    • Optional merge: boolean

      Determines whether to merge the data instead of replacing it.

      Optional

    Returns TypedModel<T, C>

Generated using TypeDoc