[ enum ] DataType
Description:
Enum for data types used with drag and drop.
Used with dragDataType(), dropDataType(), and to check if certain data type was dragged onto component.
Type: string
Properties:
| Name | Description |
|---|---|
|
No data. |
|
Accept any type. Used only for dropDataType(). |
|
Plain text. |
|
HTML content. |
|
Image data. |
|
Files from system clipboard or drag. |
|
List of URIs. |
|
A single URL string. |
|
JSON-encoded data. |
|
UI components ( |
Examples:
Sets the type of data list items represent when dragged:
list.dragDataType(DataType.FileList);
Sets the type of data Table component accepts:
table.dropDataType([DataType.FileList, DataType.URIList, DataType.URL]);
Check if expected data type was dragged onto Label:
label.dropAction(DragDropAction.CopyOrMove).dropDataType(DataType.FileList).onDropEvents(e => {
if(e.type === "drop" && Array.isArray(e.data[DataType.FileList]))
{
// set first file as label's icon image
e.target.icon(e.data[DataType.FileList][0]);
}
});
