Transfer
Last updated
Last updated
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.
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:
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:
Determine whether the Transfer
is filterable or not.
type: bool
default value: False
Initialize widget with filterable option:
Determine the placeholder for the filter field if filterable=True
.
type: str
default value: None
Initialize widget with filter placeholder:
Determine the list of titles for left and right lists.
type: List[str]
default value: None
Initialize widget with titles:
Determine the list of texts for each button.
type: List[str]
default value: None
Initialize widget with button texts:
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:
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:
The ID of the widget.
type: str
default value: None
Initialize widget with ID:
You can find this example in our GitHub repository:
supervisely-ecosystem/ui-widgets-demos/selection/010_transfer/src/main.py
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Transfer
widgetTransfer
widget@value_changed
eventPrepare 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 object with the layout parameter.
Parameters | Type | Description |
---|---|---|
Methods and attributes | Description |
---|---|
items
Union[List[Item], List[str]]
List of Transfer.Item
widgets or list of strings
transferred_items
List[str]
List of strings, containing keys from items
filterable
bool
Whether Transfer
is filterable
filter_placeholder
str
Placeholder for filter if filterable=True
titles
List[str
List of titles for left and right lists
button_texts
List[str
List of button texts for left and right lists
left_checked
List[str
List of checked items for left list
right_checked
List[str
List of checked items for right list
widget_id
str
ID of the widget
get_transferred_items()
Get the list of keys of items in the right list
get_untransferred_items()
Get the list of keys of items in the left list
@value_changed
Event that is triggered when items in the right list changed
set_items(items: Union[List[Transfer.Item], List[str]])
Set the items list (replacing it) for the widget
set_transferred_items(transferred_items: List[str])
Set the transferred items list (replacing it) for the widget
add(items: Union[List[Item], List[str]]):
Adds new items to the widget
remove(items_keys: List[str])
Remove items from the widget by key
get_items_keys()
Get the list of keys of items in the widget