Skip to main content Skip to footer

How to remove built-in calculation items from the status bar

When working with the SpreadJS Status bar, you may want to prevent users from seeing the built-in calculation items, such as Average, Count, Numerical Count, Min, Max, and Sum.

Cause

The calculation items are part of the SpreadJS Status bar UI and can be customized using the public Status bar API.

Solution

Use GC.Spread.Sheets.StatusBar.findControl(...) to access the Status Bar and the remove(...) method to remove the required calculation items:

const statusBarElement = document.getElementsByClassName('gc-statusBar')[0] as HTMLElement | undefined;
if (!statusBarElement) return;

const statusBar = GC.Spread.Sheets.StatusBar.findControl(statusBarElement);
if (!statusBar) return;

['average', 'count', 'numericalCount', 'min', 'max', 'sum'].forEach(name => {
    statusBar.remove(name);
});

This is a supported approach for removing the specified built-in Status Bar items.

The removal logic should be executed after the Designer and Status Bar have been initialized. If the Designer or Status Bar is recreated or reinitialized, the removal logic should be applied again.

These calculation items are part of the Status Bar UI and are not controlled by workbook-level settings. Workbook operations such as import/export do not normally restore the removed items.

Kristina Ismail

Technical Engagement Engineer