Explanation
The items that can be added to the component are local files and virtual files.
A local file refers to an item registered using a file dialog, and a virtual file refers to an item representing a virtual file registered using the addVirtualFile and addVirtualFileList functions.
Many manipulation functions are provided in the component to obtain information about the item.
var dx = dx5.get("component-id");
// Returns the number of all items.
var countAll = dx.getTotalItemCount();
// returns the number of local file entries.
var countLocal = dx.getTotalLocalFileCount();
// Returns the number of virtual file entries.
var countVirtual = dx.getTotalVirtualFileCount();
// Returns the number of deleted virtual file entries.
var countRemoved = dx.getTotalRemovedFileCount();
To get detailed information about a particular item, you first need to get the object.
You can use the getItems, getSelectedItems, getItemById, and getItemByIndex functions to retrieve a specific item or array.
var dx = dx5.get("component-id");
// Returning the item corresponding to the given ID or sequence.
var item1 = dx.getItemById("item id");
var item2 = dx.getItemByIndex(3);
// Returning an array of all items.
var allItems = dx.getItems();
// Returning an array of selected items
var selectedItems = dx.getSelectedItems();
// Returning an array of checked items
var checkedItems = dx.getCheckedItems();
An item is a JSON object with the following properties:
- controlId: the component ID
- id: The unique ID of the item, as determined by the component. (Multi-module and IE-module may have different ID creation methods.)
- type: The delimiter whether the item is a local file or a virtual file.
- name: The item name (filename).
- vindex: For a virtual file, this is the key that distinguishes the virtual file. (Usually the database key is used).
- openUrl: For a virtual file, this is the web path to open the file.
- downUrl: For a virtual file, this is the web path to download the file.
- size: The size of the file.
- checked: Check status of the file.
- lock: The lock status of the file.
- status: The upload status of the file.
Since all returned items are duplicated objects, changing the attribute values of the target object does not affect the internal components.
Example