[]
• 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'});
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. |
▸ 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.
}
Name | Type | Description |
---|---|---|
context |
Workbook |
The excute context for the statusbar item. |
void
▸ 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'}));
Name | Type |
---|---|
container |
HTMLElement |
void
▸ 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);
}
void
▸ 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.
}
void
▸ onUpdate(): 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.
void