[]
        
(Showing Draft Content)

GC.Spread.Sheets.StatusBar.StatusItem

Class: StatusItem

Sheets.StatusBar.StatusItem

Table of contents

Constructors

Methods

Constructors

constructor

new StatusItem(name, options?)

The base class of status item provides basic value display and related context menu item function.

example

let StatusItem = GC.Spread.Sheets.StatusBar.StatusItem;
let labelItem = new StatusItem('labelItem', {menuContent: 'label', value: 'text'});

Parameters

Name Type Description
name string The name is the Unique identifier and needed in context menu and statusbar.
options? Object The object of status item options.

Methods

onBind

onBind(context): void

Bind the Context. Can override to add context related event listener.

override

example

LabelItem.prototype.onBind = function (context) {
  // do something about context.
}

Parameters

Name Type Description
context Workbook The excute context for the statusbar item.

Returns

void


onCreateItemView

onCreateItemView(container): void

Create the item element on statusbar. Can override for customize item.

override

example

let StatusItem = GC.Spread.Sheets.StatusBar.StatusItem;
function LabelItem (name, options) {
  StatusItem.call(this, name, options);
}
LabelItem.prototype = new StatusItem();
LabelItem.prototype.onCreateItemView = function (container) {
  let item = document.createElement('div');
  item.innerText = this.value;
  container.appendChild(item);
  // add event listener for container
}
statusBar.add(new LabelItem('labelItem', {menuContent: 'label', value: 'options test'}));

Parameters

Name Type
container HTMLElement

Returns

void


onDispose

onDispose(): void

Dispose the statusbar to unbind context, remove all listener and dispose all element.

override

example

let StatusItem = GC.Spread.Sheets.StatusBar.StatusItem;
function LabelItem (name, options) {
  StatusItem.call(this, name, options);
}
LabelItem.prototype = new StatusItem();
LabelItem.prototype.onDispose = function () {
  // dispose current item.
  // then call super dispose.
  StatusItem.prototype.onDispose.call(this);
}

Returns

void


onUnbind

onUnbind(): void

Unbind the Context. Can override to remove context related event listener.

override

example

LabelItem.prototype.onUnbind = function () {
  // remove event listener related to context.
}

Returns

void


onUpdate

onUpdate(content?): void

The callback for status bar update. Called when status bar bind or update function, or status bar check changed in context menu. The update related operations can realize in it. Users also should call onUpdate when current item need update. The default operations in super is update current item by visible.

override

example

let StatusItem = GC.Spread.Sheets.StatusBar.StatusItem;
function LabelItem (name, options) {
  StatusItem.call(this, name, options);
}
LabelItem.prototype = new StatusItem();
LabelItem.prototype.onUpdate = function () {
  StatusItem.prototype.onUpdate.call(this);
  // update item.

Parameters

Name Type Description
content? string The string content to be displayed on the StatusItem.

Returns

void