eLabSDK.Label
Functions
| Name | Description |
|---|---|
| renderLabel(data) | Render a custom label with the provided data. |
This is a base method for rendering label content. Currently it accesses the contents
property from the data object. Use this as a foundation for custom label rendering
implementations or extend this class to create specialized label types.
renderExperimentLabel(config) | Open a dialog for printing a barcode label for an experiment.
This displays a modal dialog containing a DYMO label printer interface for the specified
experiment. The label includes experiment information like the experiment ID (as a barcode),
name, and optionally the author. The dialog loads the label printing interface in an iframe,
allowing users to print physical labels for their experiments using a DYMO label printer.
Use this to enable users to create physical labels for experiment tracking and organization.
renderLabel(data)
Render a custom label with the provided data.
This is a base method for rendering label content. Currently it accesses the contents
property from the data object. Use this as a foundation for custom label rendering
implementations or extend this class to create specialized label types.
Kind: global function
| Param | Type | Description |
|---|---|---|
| data | Object | Configuration object for the label |
| data.contents | string | The content to render in the label |
Example
// Basic label rendering
var label = new eLabSDK.Label();
label.renderLabel({
contents: 'Sample Label Content'
});
Example
// Custom label with HTML content
var label = new eLabSDK.Label();
label.renderLabel({
contents: '<strong>Sample ID:</strong> 12345<br><strong>Date:</strong> 2024-11-27'
});
renderExperimentLabel(config)
Open a dialog for printing a barcode label for an experiment.
This displays a modal dialog containing a DYMO label printer interface for the specified
experiment. The label includes experiment information like the experiment ID (as a barcode),
name, and optionally the author. The dialog loads the label printing interface in an iframe,
allowing users to print physical labels for their experiments using a DYMO label printer.
Use this to enable users to create physical labels for experiment tracking and organization.
Kind: global function
| Param | Type | Default | Description |
|---|---|---|---|
| config | Object | Configuration object for the experiment label | |
| config.experimentID | number | The numeric ID of the experiment to create a label for | |
| [config.hideAuthor] | boolean | false | Whether to hide the author name on the label |
Example
// Print label for an experiment
var label = new eLabSDK.Label();
label.renderExperimentLabel({
experimentID: 1234
});
Example
// Print label without author information
var label = new eLabSDK.Label();
label.renderExperimentLabel({
experimentID: 5678,
hideAuthor: true
});
Example
// Add custom button to print experiment label
eLabSDK.ready(function() {
var printLabelBtn = new eLabSDK.GUI.Button({
label: 'Print Label',
icon: 'fa-barcode',
action: function() {
var experimentId = getExperimentIdFromPage();
var label = new eLabSDK.Label();
label.renderExperimentLabel({
experimentID: experimentId
});
}
});
var page = new eLabSDK.Page();
page.addButton(printLabelBtn);
});
Example
// Print labels for multiple experiments
var experimentIds = [101, 102, 103];
var label = new eLabSDK.Label();
experimentIds.forEach(function(expId) {
label.renderExperimentLabel({
experimentID: expId,
hideAuthor: false
});
});
© 2023 eLabNext
Updated about 16 hours ago