eLabSDK2.Inventory.StorageUnit.StorageUnitList
Hierarchy
-
↳
StorageUnitList
Methods
getSelectedStorageUnits
Static getSelectedStorageUnits(): StorageUnitInterface[]
Get the complete storage unit objects for all currently selected storage units in the inventory list.
This retrieves an array of full storage unit objects for all storage units that the user has
selected (checked) in the inventory browser list view. Each storage unit object includes
comprehensive information like name, location (building, room, floor), barcode, storage type,
status, and more. Use this for bulk operations on multiple storage units such as exporting,
updating properties, or generating reports. Returns an empty array if no storage units are selected.
Returns
StorageUnitInterface[]
An array of StorageUnitInterface objects containing all properties for each selected storage unit.
Example
// Get selected storage unit details
const selected = eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits();
console.log(`${selected.length} storage units selected`);
selected.forEach(unit => {
console.log(`${unit.name} - ${unit.storageType} in ${unit.building}, ${unit.room}`);
});
Example
// Perform bulk operation on selected units
const units = eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits();
if (units.length > 0) {
const unitIds = units.map(u => u.storageID);
await updateStorageUnitProperties(unitIds, { status: 'ACTIVE' });
eLabSDK2.UI.Toast.showToast(`${units.length} units updated`, 2000);
}
Example
// Export selected units to CSV
const units = eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits();
if (units.length === 0) {
eLabSDK2.UI.Toast.showToast('Please select at least one storage unit');
return;
}
const csvData = units.map(u => ({
Name: u.name,
Type: u.storageType,
Location: `${u.building}, ${u.room}`,
Barcode: u.barcode,
Status: u.status
}));
exportToCSV(csvData, 'storage-units.csv');
registerAction
Static registerAction(action): void
Register a custom bulk action button for storage units in the inventory list view.
This adds a custom bulk action button that appears when one or more storage units are
selected in the inventory browser list. Bulk actions allow you to perform operations on
multiple storage units at once, such as updating properties, exporting data, or generating
reports. The action visibility can be controlled using conditional logic via showCondition.
Parameters
| Name | Type | Description |
|---|---|---|
action | Action | { id: string, label: string, title?: string, icon?: string, onClick?: () => void, showCondition?: () => boolean } |
Returns
void
Example
// Add bulk export action for selected storage units
const exportAction = {
id: 'bulk-export-units',
label: 'Export Selected',
title: 'Export selected storage units to CSV',
icon: 'fas fa-file-export',
onClick: () => {
const selectedUnits = eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits();
exportStorageUnitsToCSV(selectedUnits);
},
showCondition: () => {
return eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits().length > 0;
}
};
eLabSDK2.Inventory.StorageUnit.StorageUnitList.registerAction(exportAction);
Example
// Add bulk status update action
const markMaintenanceAction = {
id: 'mark-maintenance',
label: 'Mark as Maintenance',
icon: 'fas fa-wrench',
onClick: async () => {
const units = eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits();
await updateStorageUnitStatus(units.map(u => u.storageID), 'MAINTENANCE');
eLabSDK2.UI.Toast.showToast(`${units.length} units marked for maintenance`, 2000);
},
showCondition: () => {
return eLabSDK2.Inventory.StorageUnit.StorageUnitList.getSelectedStorageUnits().length > 0;
}
};
eLabSDK2.Inventory.StorageUnit.StorageUnitList.registerAction(markMaintenanceAction);
© 2023 eLabNext
Updated about 4 hours ago