Back to Website
Show / Hide Table of Contents

Class AuWidgetOption

A widget that is used to select product options provided by an e-commerce system such as paper types, colors, sizes, etc. For details, you can refer to the Option widget topic.

{
  "widgets": [
    {
      "title": "Book Size (Inches)",
      "name": "books",
      "type": "option",
      "params": {
        "type": "list",
        "title": "Book Size (Inches)",
        "initWithEmptyValue": true,
        "placeholderText": "Select a book size",
        "values": []
      }
    },
    {
      "title": "Type of Pages",
      "name": "pages",
      "type": "option",
      "params": {
        "type": "radio",
        "subType": "compact",
        "title": "Type of Pages",
        "initWithEmptyValue": true,
        "placeholderText": "Select a type",
        "values": []
      }
    }
  ]
}
Package: ui-framework

Properties

definition

An option definition obtained from the e-commerce driver.

Declaration
public definition: IOption
Property Value
Type Description
IOption

An option definition obtained from the e-commerce driver.

element

An option obtained from the e-commerce driver.

Declaration
public element: AuOptionBase
Property Value
Type Description
AuOptionBase

An option obtained from the e-commerce driver.

order

An order obtained from the e-commerce driver.

Declaration
public order: IOrder
Property Value
Type Description
IOrder

An order obtained from the e-commerce driver.

params

Compiled widget configuration.

Declaration
params: any
Property Value
Type Description
any

Compiled widget configuration.

placeholderText

Declaration
public placeholderText: string
Property Value
Type Description
string

selected

Returns the selected value.

Declaration
string | IWidgetOptionValue & SelectedOption selected
Property Value
Type Description
string | IWidgetOptionValue & SelectedOption

Returns the selected value.

Methods

checkInitDependenciesWidgets()

Returns an array of widget names, due to which the current widget cannot receive parameters.

Declaration
function checkInitDependenciesWidgets()
Returns
Type Description
string[]

clearSelection()

Sets the value of the option to null.

Declaration
function clearSelection()

exportWidgetData(boolean)

Declaration
function exportWidgetData(force: boolean)
Parameters
Type Name Description
boolean force
Returns
Type Description
Promise<OptionsData>

resetPreloaderState()

Declaration
function resetPreloaderState()

restoreWidgetFromData(OptionsData, boolean)

Declaration
function restoreWidgetFromData(widgetData: OptionsData, force: boolean)
Parameters
Type Name Description
OptionsData widgetData
boolean force
Returns
Type Description
Promise<void>

showPreloader(boolean, string | string[], number)

Shows a preloader.

"onClick": [
  "{{#function main.showPreloader(true, 'Creating print files...')}}",
  "{{#function $['editor'].getHiResImages(800,800)}}",
  "{{#function main.showPreloader(false)}}"
]
Declaration
function showPreloader(isPreload: boolean, message: string | string[], timeout: number)
Parameters
Type Name Description
boolean isPreload

If true, enables the preloader.

string | string[] message

A text message that appears next to the preloader.

number timeout

showToast(string, number)

Shows a toast.

return editor.loadUserInfo(data)
    .catch(err => {
        this.widget.showToast("Error: Invalid data");
        console.log(err);
    });
Declaration
function showToast(data?: string, duration?: number)
Parameters
Type Name Description
string data

A string message to display in the toast.

number duration

Defines how long to show the toast for.

Was this page helpful?
Thanks for your feedback!
Back to top Copyright © 2001–2024 Aurigma, Inc. All rights reserved.
Loading...
    Thank for your vote
    Your opinion is important to us. To provide details, send feedback.
    Send feedback