eLabSDK.Page.Protocol
Functions
| Name | Description |
|---|---|
| addButtonToListView(btn) | Add a custom button to the protocol list view toolbar. |
This adds a custom button to the toolbar displayed on the protocol list page. The button
appears at the beginning of the button bar with the configured icon and label. The button
is added immediately if the protocol list is already loaded, otherwise it waits for the
list to load. Requires a unique actionID to prevent duplicate buttons. Use this to add
custom bulk operations or actions that apply to protocols in the list view.
addButtonToProtocolTopToolBar(btn) | Add a custom button to the protocol detail page toolbar.
This adds a custom action button to the toolbar displayed on individual protocol detail
pages. The button appears alongside standard actions like "Edit", "Delete", "Copy", etc.
The button is rendered with an icon and label in the toolbar style. If a button with the
same actionID already exists, it is replaced. Use this to add custom protocol operations
accessible from the protocol detail view.
addButtonToListView(btn)
Add a custom button to the protocol list view toolbar.
This adds a custom button to the toolbar displayed on the protocol list page. The button
appears at the beginning of the button bar with the configured icon and label. The button
is added immediately if the protocol list is already loaded, otherwise it waits for the
list to load. Requires a unique actionID to prevent duplicate buttons. Use this to add
custom bulk operations or actions that apply to protocols in the list view.
Kind: global function
| Param | Type | Description |
|---|---|---|
| btn | eLabSDK.GUI.Button | An eLabSDK.GUI.Button instance with actionID, icon, label, and action configured |
Example
// Add export button to protocol list
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var exportBtn = new eLabSDK.GUI.Button({
actionID: 'exportProtocols',
label: 'Export All',
icon: 'download',
action: function(btn) {
console.log('Exporting all protocols');
exportAllProtocols();
}
});
this.addButtonToListView(exportBtn);
}
});
});
Example
// Add custom import button
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var importBtn = new eLabSDK.GUI.Button({
actionID: 'importProtocol',
label: 'Import from File',
icon: 'upload',
action: function(btn) {
openImportDialog();
}
});
this.addButtonToListView(importBtn);
}
});
});
Example
// Add button with counter
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var reviewBtn = new eLabSDK.GUI.Button({
actionID: 'reviewPending',
label: 'Review Pending',
icon: 'clipboard-check',
action: function() {
showPendingProtocols();
}
});
reviewBtn.addCounter({
source: '/api/v1/protocols/pending/count'
});
this.addButtonToListView(reviewBtn);
}
});
});
addButtonToProtocolTopToolBar(btn)
Add a custom button to the protocol detail page toolbar.
This adds a custom action button to the toolbar displayed on individual protocol detail
pages. The button appears alongside standard actions like "Edit", "Delete", "Copy", etc.
The button is rendered with an icon and label in the toolbar style. If a button with the
same actionID already exists, it is replaced. Use this to add custom protocol operations
accessible from the protocol detail view.
Kind: global function
| Param | Type | Description |
|---|---|---|
| btn | eLabSDK.GUI.Button | An eLabSDK.GUI.Button instance with actionID, icon, label, and action configured |
Example
// Add export button to protocol detail page
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var exportBtn = new eLabSDK.GUI.Button({
actionID: 'exportProtocolPDF',
label: 'Export PDF',
icon: 'file-pdf',
action: function() {
var protocolID = getProtocolIDFromPage();
exportProtocolToPDF(protocolID);
}
});
this.addButtonToProtocolTopToolBar(exportBtn);
}
});
});
Example
// Add button to send protocol via email
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var sendBtn = new eLabSDK.GUI.Button({
actionID: 'sendProtocolEmail',
label: 'Send via Email',
icon: 'envelope',
action: function() {
var protocolID = getProtocolIDFromPage();
openEmailDialog(protocolID);
}
});
this.addButtonToProtocolTopToolBar(sendBtn);
}
});
});
Example
// Add button to integrate with external system
eLabSDK.ready(function() {
var protocolPage = new eLabSDK.Page.Protocol({
onReady: function() {
var syncBtn = new eLabSDK.GUI.Button({
actionID: 'syncToLIMS',
label: 'Sync to LIMS',
icon: 'sync',
action: function() {
var protocolID = getProtocolIDFromPage();
$.post('/api/lims/sync-protocol', { protocolID: protocolID }, function() {
alert('Protocol synced to LIMS successfully');
});
}
});
this.addButtonToProtocolTopToolBar(syncBtn);
}
});
});
© 2023 eLabNext
Updated about 18 hours ago