gws.plugin.model_widget.select

Select widget.

Drop-down list with a fixed set of items, optionally with a search field. Each item has a value, which is stored in the field, and a text to display, which defaults to the value. The extraText and level options of an item are not passed to the client.

Example:

fields+ {
    name "kind"
    type "text"
    widget {
        type "select"
        withSearch true
        items [
            { value "a" text "Type A" }
            { value "b" text "Type B" }
        ]
    }
}

Source code: gws.plugin.model_widget.select

Package Contents

class gws.plugin.model_widget.select.Config

Bases: gws.base.model.widget.Config

Drop-down list with a fixed set of values.

items: list[ListItemConfig]

Options to choose from.

withSearch: bool = False

Show a search field to filter the options.

class gws.plugin.model_widget.select.ListItem(*args, **kwargs)

Bases: gws.Data

Item in the select widget.

extraText: str | None

Additional text to display for the item.

level: int | None

Optional level for hierarchical items, used for indentation.

text: str

Text to display for the item.

value: Any

Value of the item.

class gws.plugin.model_widget.select.ListItemConfig(*args, **kwargs)

Bases: gws.Config

Option of a select widget.

extraText: str | None

Additional text to display for the item.

level: int | None

Optional level for hierarchical items, used for indentation.

text: str | None

Label shown for the item.

value: Any

Value stored in the field when the item is selected.

class gws.plugin.model_widget.select.Object

Bases: gws.base.model.widget.Object

Select widget object.

props(user)
class gws.plugin.model_widget.select.Props

Bases: gws.base.model.widget.Props

items: list[ListItem]
withSearch: bool