Transfer
Introduction
The Transfer
widget in Supervisely is a user interface element that allows users to transfer items between two lists. The Transfer widget is useful for creating project dashboards that require users to transfer items between two lists quickly and easily. Users can customize the appearance and behavior of the Transfer widget to match their project requirements, such as adding filterable options and customizing the names of the lists, buttons, and more. Overall, the Transfer widget is a simple tool to select needed or remove unnecessary items from the list. The Transfer
widget has event handlers that are triggered when items in the right lists are changed. This can be useful for applications that require dynamic change handling, such as showing data from the selected items.
Function signature
Parameters
Parameters | Type | Description |
---|---|---|
|
| List of |
|
| List of strings, containing keys from |
|
| Whether |
|
| Placeholder for filter if |
|
| List of titles for left and right lists |
|
| List of button texts for left and right lists |
|
| List of checked items for left list |
|
| List of checked items for right list |
|
| ID of the widget |
items
Determine the list of Transfer.Item
widgets or list of strings, containing keys for items, from which Transfer.Item
widgets will be created.
type: Union[List[Item], List[str]]
default value: None
Prepare transfer items:
Initialize widget with given items:
transferred_items
Determine the list of strings, containing keys for items, that will be shown in the right list. Note: transferred_items
should be a subset of keys of items
, otherwise the error will be raised.
type: List[str]
default value: None
Initialize widget with transferred items:
filterable
Determine whether the Transfer
is filterable or not.
type: bool
default value: False
Initialize widget with filterable option:
filter_placeholder
Determine the placeholder for the filter field if filterable=True
.
type: str
default value: None
Initialize widget with filter placeholder:
titles
Determine the list of titles for left and right lists.
type: List[str]
default value: None
Initialize widget with titles:
button_texts
Determine the list of texts for each button.
type: List[str]
default value: None
Initialize widget with button texts:
left_checked
Determine the list of items that will be checked in the left list when the widget is initialized.
type: List[str]
default value: None
Initialize widget with checked items:
right_checked
Determine the list of items that will be checked in the right list when the widget is initialized.
type: List[str]
default value: None
Initialize widget with checked items:
widget_id
The ID of the widget.
type: str
default value: None
Initialize widget with ID:
Methods and attributes
Methods and attributes | Description |
---|---|
| Get the list of keys of items in the right list |
| Get the list of keys of items in the left list |
| Event that is triggered when items in the right list changed |
| Set the items list (replacing it) for the widget |
| Set the transferred items list (replacing it) for the widget |
| Adds new items to the widget |
| Remove items from the widget by key |
| Get the list of keys of items in the widget |
Mini app example
You can find this example in our GitHub repository:
supervisely-ecosystem/ui-widgets-demos/selection/010_transfer/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare items for Transfer
widget
Transfer
widgetInitialize Transfer
widget
Transfer
widgetChanging the list of transferred items
Removing an item and getting keys of items (all, transferred, untransferred)
Using @value_changed
event
@value_changed
eventCreate app layout
Prepare a layout for the app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create an app using the layout
Create an app object with the layout parameter.
Last updated