eLabSDK.Page.ExperimentBrowser

Functions

NameDescription
addOptionalColumns(additionalColumns)Add custom optional columns to the experiment browser table.

This allows you to display additional columns in the experiment browser table beyond the
default columns. The columns must be from the list of available optional columns returned
by getOptionalColumns(). The columns are added via the message bus before the experiments
table loads. Use this to customize the experiment browser view to display additional
information relevant to your workflow.
getOptionalColumns() | Get the list of available optional columns for the experiment browser.

This returns an array of column names that can be added to the experiment browser table
using addOptionalColumns(). Use this to discover which additional columns are available
before attempting to add them, ensuring your customizations only use valid column names.

addOptionalColumns(additionalColumns)

Add custom optional columns to the experiment browser table.

This allows you to display additional columns in the experiment browser table beyond the
default columns. The columns must be from the list of available optional columns returned
by getOptionalColumns(). The columns are added via the message bus before the experiments
table loads. Use this to customize the experiment browser view to display additional
information relevant to your workflow.

Kind: global function

ParamTypeDescription
additionalColumnsArray.<string>Array of column names to add to the table

Example

// Add "Created By" column to experiment browser
eLabSDK.ready(function() {
  var expBrowser = new eLabSDK.Page.ExperimentBrowser();
  expBrowser.addOptionalColumns(['Created By']);
});

Example

// Add multiple optional columns
eLabSDK.ready(function() {
  var expBrowser = new eLabSDK.Page.ExperimentBrowser();
  var columnsToAdd = ['Created By', 'Last Modified'];
  expBrowser.addOptionalColumns(columnsToAdd);
});

Example

// Check available columns before adding
eLabSDK.ready(function() {
  var expBrowser = new eLabSDK.Page.ExperimentBrowser();
  var availableColumns = expBrowser.getOptionalColumns();
  console.log('Available columns:', availableColumns);
  
  // Add only if available
  if (availableColumns.indexOf('Created By') > -1) {
    expBrowser.addOptionalColumns(['Created By']);
  }
});

getOptionalColumns()

Get the list of available optional columns for the experiment browser.

This returns an array of column names that can be added to the experiment browser table
using addOptionalColumns(). Use this to discover which additional columns are available
before attempting to add them, ensuring your customizations only use valid column names.

Kind: global function
Returns: Array.<string> - Array of available optional column names
Example

// Get and display available optional columns
eLabSDK.ready(function() {
  var expBrowser = new eLabSDK.Page.ExperimentBrowser();
  var columns = expBrowser.getOptionalColumns();
  console.log('Available optional columns:', columns);
  // Output: ['Created By']
});

Example

// Conditionally add columns based on availability
eLabSDK.ready(function() {
  var expBrowser = new eLabSDK.Page.ExperimentBrowser();
  var available = expBrowser.getOptionalColumns();
  var desired = ['Created By', 'Last Modified', 'Tags'];
  
  // Only add columns that are actually available
  var toAdd = desired.filter(function(col) {
    return available.indexOf(col) > -1;
  });
  
  if (toAdd.length > 0) {
    expBrowser.addOptionalColumns(toAdd);
  }
});

.getCurrentStudyID()

Get the ID of the currently selected study in the experiment browser.

This static method retrieves the study ID that is currently selected/active in the experiment
browser interface. The experiment browser displays experiments filtered by study, and this
returns which study is currently being viewed. Returns null if no study is selected. Use this
to determine the current context when adding custom functionality to the experiment browser.

Kind: static function
Returns: numbernull - The numeric study ID currently selected, or null if none selected
Example

// Get current study and add custom button for it
eLabSDK.ready(function() {
  var studyID = eLabSDK.Page.ExperimentBrowser.getCurrentStudyID();
  
  if (studyID) {
    console.log('Currently viewing study: ' + studyID);
    
    var exportBtn = new eLabSDK.GUI.Button({
      label: 'Export Study',
      icon: 'download',
      action: function() {
        exportStudyExperiments(studyID);
      }
    });
    
    var expBrowser = new eLabSDK.Page.Experiment();
    expBrowser.addButtonToBrowser(exportBtn);
  }
});

Example

// Load study details based on current selection
eLabSDK.ready(function() {
  var studyID = eLabSDK.Page.ExperimentBrowser.getCurrentStudyID();
  
  if (studyID) {
    var study = new eLabSDK.Study({
      studyID: studyID,
      onLoaded: function() {
        console.log('Study name: ' + this.data.name);
        console.log('Study meta:', this.getMeta());
      }
    });
  }
});

Example

// Conditional feature based on study
eLabSDK.ready(function() {
  var studyID = eLabSDK.Page.ExperimentBrowser.getCurrentStudyID();
  
  if (!studyID) {
    console.log('No study selected - showing all experiments');
  } else {
    console.log('Viewing experiments for study: ' + studyID);
    enableStudySpecificFeatures(studyID);
  }
});

© 2023 eLabNext