[]
        
(Showing Draft Content)

GC.Spread.Sheets.NameBox.NameBox

Class: NameBox

Sheets.NameBox.NameBox

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new NameBox(host, workbook, options?)

Represents name box.

Parameters

Name Type Description
host string | HTMLElement The DOM Element.
workbook Workbook -
options? INameBoxOptions -

Properties

options

options: INameBoxOptions

Indicates the options of the name box.

property [enableAddCustomName] Indicates whether enable add custom name when input a name which is not existed to the selector.

property [enableNavigateToRange] Indicates whether enable navigate to the named range or drawing item when input its name or click on custom list item.

property [showCustomNameList] Indicates whether show the custom name list dropdown indicator.

property [dropDownMaxHeight] Indicates the drop down list element max height.

example

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var div = document.createElement('div');
div.id = 'nameBox';
div.style.width = '300px';
div.style.height = '50px';
document.getElementById('panel').appendChild(div);

var nameBox = new GC.Spread.Sheets.NameBox.NameBox(document.getElementById('nameBox'), spread);
nameBox.options.enableAddCustomName = false; // cannot add custom name with inputting in name box input box now.
nameBox.options.enableNavigateToRange = false; // cannot swap the selected range to the value of the name box input box now.
nameBox.options.showCustomNameList = false; // cannot open the custom name list by down arrow button right side and the button will be hidden now.
nameBox.options.dropDownMaxHeight = 100; // the custom name list host DOM element height will no larger than 100px now.

Methods

dispose

dispose(): void

Dispose the NameBox and unbind all events.

example

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var nameBox = new GC.Spread.Sheets.NameBox.NameBox(document.getElementById('nameBox'), spread);
// do something
nameBox.dispose();

Returns

void


getHost

getHost(): HTMLElement

get the NameBox host element.

example

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var nameBox = new GC.Spread.Sheets.NameBox.NameBox(document.getElementById('nameBox'), spread);
var host = nameBox.getHost();

Returns

HTMLElement


refresh

refresh(): void

refresh the NameBox and sync the name box value to the work sheet selection.

example

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
var nameBox = new GC.Spread.Sheets.NameBox.NameBox(document.getElementById('nameBox'), spread);
var sheet = spread.getActiveSheet();
sheet.setSelection(0, 0, 3, 3);
nameBox.refresh();

Returns

void