Back to Grapesjs

Property Select

docs/api/property_select.md

0.22.161.7 KB
Original Source
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

PropertySelect

Extends Property

Properties

  • options Array<Object> Array of option definitions.
    js
    options: [
     { id: '100', label: 'Set 100' },
     { id: '200', label: 'Set 200' },
    ]
    

getOptions

Get available options.

Returns Array<Object> Array of options

getOption

Get current selected option or by id.

Parameters

Returns (Object | null)

setOptions

Update options.

Parameters

  • value Array<Object> New array of options, eg. [{ id: 'val-1', label: 'Value 1' }] (optional, default [])

addOption

Add new option.

Parameters

  • value Object Option object, eg. { id: 'val-1', label: 'Value 1' }

getOptionId

Get the option id from the option object.

Parameters

Returns String Option id

getOptionLabel

Get option label.

Parameters

  • id (String | Object) Option id or the option object

  • opts Object Options (optional, default {})

    • opts.locale Boolean Use the locale string from i18n module (optional, default true)

Returns String Option label