eLabSDK2.Inventory.Sample.SeriesDetail

Hierarchy

Methods

onAfterPageLoad

Static onAfterPageLoad(callback, id): void

Register a callback to execute after the series detail page DOM has been fully rendered.

This event fires after the page has completed rendering and all initial series data is
loaded and displayed. Use this for tasks that require the DOM elements to exist, such as
manipulating page elements, attaching event listeners, initializing UI components, or
performing actions based on the loaded series data.

Parameters

NameTypeDescription
callbackFunctionFunction to execute after the DOM is rendered. Receives detail information as parameter.
idstringUnique identifier for this callback registration.

Returns

void

Example

// Add custom visualizations after page loads
eLabSDK2.Inventory.Sample.SeriesDetail.onAfterPageLoad((detail) => {
  console.log('Series detail rendered:', detail);
  const seriesId = eLabSDK2.Inventory.Sample.SampleDetail.getSeriesID();
  if (seriesId) {
    renderSeriesChart(seriesId);
  }
}, 'render-visualizations');

Example

// Attach event listeners after render
eLabSDK2.Inventory.Sample.SeriesDetail.onAfterPageLoad(() => {
  document.querySelectorAll('.series-sample-row').forEach(row => {
    row.addEventListener('click', handleSampleClick);
  });
}, 'attach-listeners');

Example

// Measure page load time
eLabSDK2.Inventory.Sample.SeriesDetail.onAfterPageLoad(() => {
  const loadTime = Date.now() - window.seriesLoadStartTime;
  console.log(`Series detail loaded in ${loadTime}ms`);
  trackAnalytics('series_detail_load_time', loadTime);
}, 'measure-performance');

Overrides

Sample.onAfterPageLoad


onBeforePageLoad

Static onBeforePageLoad(callback, id): void

Register a callback to execute before the series detail page loads data and renders the DOM.

This event fires at the beginning of the series detail page load process, before the series
data is fetched or the DOM is rendered. Use this for early initialization tasks such as
setting up validation rules, preparing data structures, or configuring page behavior before
it becomes visible to the user.

Parameters

NameTypeDescription
callbackFunctionFunction to execute before page load begins. Receives detail information as parameter.
idstringUnique identifier for this callback registration.

Returns

void

Example

// Initialize custom state before page loads
eLabSDK2.Inventory.Sample.SeriesDetail.onBeforePageLoad((detail) => {
  console.log('Series detail loading:', detail);
  setupSeriesAnalytics();
  prepareSeriesFilters();
}, 'init-series-detail');

Example

// Track page load performance
eLabSDK2.Inventory.Sample.SeriesDetail.onBeforePageLoad(() => {
  window.seriesLoadStartTime = Date.now();
}, 'performance-tracking');

Overrides

Sample.onBeforePageLoad


registerAction

Static registerAction(action): void

Register a custom action button in the series detail page.

This adds a custom action button to the series detail page, typically appearing in the
actions toolbar or menu. Actions can be used to perform operations on the entire series,
analyze series data, export results, or trigger custom workflows. The action visibility
can be controlled conditionally based on series properties.

Parameters

NameTypeDescription
actionAction{ id: string, label: string, icon?: string, onClick: () => void, isVisible?: () => boolean }

Returns

void

Example

// Add series analysis action
eLabSDK2.Inventory.Sample.SeriesDetail.registerAction({
  id: 'analyze-series',
  label: 'Analyze Series',
  icon: 'fas fa-chart-line',
  onClick: () => {
    const seriesId = eLabSDK2.Inventory.Sample.SampleDetail.getSeriesID();
    openSeriesAnalysis(seriesId);
  }
});

Example

// Add export series action
eLabSDK2.Inventory.Sample.SeriesDetail.registerAction({
  id: 'export-series',
  label: 'Export to CSV',
  icon: 'fas fa-file-csv',
  onClick: async () => {
    const seriesId = eLabSDK2.Inventory.Sample.SampleDetail.getSeriesID();
    const seriesData = await fetchSeriesData(seriesId);
    exportToCSV(seriesData);
  }
});

reloadSeries

Static reloadSeries(): void

Reload the currently displayed sample series with fresh data from the server.

This refreshes the series data in the series detail view, fetching the latest information
for the currently selected series and all its member samples. It also clears any sample
selections in the list. Use this after making changes to the series or its member samples
to ensure the display reflects the current state.

Returns

void

Example

// Reload series after adding a sample
async function addSampleToSeries(sampleId, seriesId) {
  await api.addSampleToSeries(sampleId, seriesId);
  eLabSDK2.Inventory.Sample.SeriesDetail.reloadSeries();
  eLabSDK2.UI.Toast.showToast('Sample added to series', 2000);
}

Example

// Reload after bulk operation on series samples
eLabSDK2.Inventory.Sample.SeriesDetail.registerAction({
  id: 'refresh-series',
  label: 'Refresh',
  icon: 'fas fa-sync',
  onClick: () => {
    eLabSDK2.Inventory.Sample.SeriesDetail.reloadSeries();
  }
});

© 2023 eLabNext