[]
        
(Showing Draft Content)

GC.Spread.Sheets.Slicers.DOMTableSlicer

类: DOMTableSlicer

Sheets.Slicers.DOMTableSlicer

继承关系

Table of contents

构造方法

属性

方法

构造方法

constructor

new DOMTableSlicer(name, table, columnName)

切片器

参数

属性名 类型 说明
name string 切片器名称
table Table 与切片器有关的表
columnName string 表的列的名称

Overrides

FloatingObject.constructor

属性

typeName

typeName: string

支持序列化的类型名称字符串

继承自

FloatingObject.typeName

方法

allowMove

allowMove(value?): any

获取或设置是否禁用移动浮动对象元素

代码示例

//本示例阻止您移动或调整浮动对象元素的大小
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.allowResize(false);
customFloatingObject.allowMove(false);
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 是否禁用移动浮动对象元素的设置

返回值

any

如果未设置任何值,则返回是否禁用移动浮动对象元素的设置;否则,返回浮动对象元素

继承自

FloatingObject.allowMove


allowResize

allowResize(value?): any

获取或设置是否禁用调整浮动对象的大小

代码示例

//本示例阻止您移动或调整浮动对象元素的大小
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.allowResize(false);
customFloatingObject.allowMove(false);
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 是否禁用调整浮动对象大小的设置

返回值

any

如果未设置任何值,则返回是否禁用调整浮动对象大小的设置;否则,返回浮动对象

继承自

FloatingObject.allowResize


alt

alt(value?): any

获取或设置浮动对象的可选文本

代码示例

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
customFloatingObject.alt("A button");
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? string 浮动对象的可选文本

返回值

any

浮动对象的可选文本

继承自

FloatingObject.alt


captionName

captionName(value?): any

获取或设置切片器的标题名称

代码示例

//本示例使用了captionName方法
//create a table
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
//切片器样式
var style1 = new GC.Spread.Sheets.Slicers.SlicerStyles.light4();
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
 //改变切片器的属性
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.captionName("S1");
slicer.style(style1);

参数

属性名 类型
value? string

返回值

any

如果没有设置值,返回切片器的标题名称;否则,返回切片器


cloneContent

cloneContent(): HTMLElement

获取当前实例的内容副本

代码示例

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 64, 30);
customFloatingObject.content(createButton('button 1', '64px', '30px'));
activeSheet.floatingObjects.add(customFloatingObject);

var btn = customFloatingObject.cloneContent();
btn.innerText = 'button 2';
customFloatingObject.content(btn);

function createButton (text, width, height) {
    var btn = document.createElement('button');
    btn.style.width = width;
    btn.style.height = height;
    btn.innerText = text;
    return btn;
}

返回值

HTMLElement

当前实例内容的副本

继承自

FloatingObject.cloneContent


columnCount

columnCount(value?): any

获取或设置切片器的列数

代码示例

//This example changes the slicer column count
//create a table
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
//add a slicer to the sheet and return the slicer instance.
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
console.log(slicer.columnCount());
slicer.columnCount(3);
console.log(slicer.columnCount());

参数

属性名 类型
value? number

返回值

any

如果没有设置值,返回切片器的列数;否则,返回切片器


content

content(value?): any

获取或设置自定义浮动对象元素的内容

代码示例

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 64, 30);
customFloatingObject.content(createButton('button 1', '64px', '30px'));
activeSheet.floatingObjects.add(customFloatingObject);

console.log(customFloatingObject.content()); // get current content, the result is button element with the text "button 1".
customFloatingObject.content(createButton('button 2', '64px', '30px')); // set new content.

function createButton (text, width, height) {
    var btn = document.createElement('button');
    btn.style.width = width;
    btn.style.height = height;
    btn.innerText = text;
    return btn;
}

参数

属性名 类型
value? HTMLElement

返回值

any

如果未设置任何值,则返回自定义浮动对象元素的内容;否则,返回浮动对象元素

继承自

FloatingObject.content


disableResizingAndMoving

disableResizingAndMoving(value?): any

获取或设置是否禁止调整切片器的大小和移动

代码示例

//本示例禁止移动或调整切片器的大小
//创建一个表
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
//切片器样式
var style1 = new GC.Spread.Sheets.Slicers.SlicerStyles.light4();
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//change the slicer properties.
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.disableResizingAndMoving(true);
slicer.style(style1);

参数

属性名 类型
value? boolean

返回值

any

如果没有设置值,则返回是否禁用调整大小和移动切片器;否则,返回切片器


dynamicMove

dynamicMove(value?): any

获取或设置对象在隐藏或显示,调整大小或移动行或列时是否移动

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 该值指示对象在隐藏或显示,调整大小或移动行或列时是否移动

返回值

any

如果未设置任何值,则返回此浮动对象元素是否动态移动;否则,返回浮动对象元素

继承自

FloatingObject.dynamicMove


dynamicSize

dynamicSize(value?): any

获取或设置在隐藏或显示,调整大小或移动行或列时对象的大小是否改变

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 该值指示在隐藏或显示,调整大小或移动行或列时对象的大小是否改变

返回值

any

如果未设置任何值,则返回此浮动对象元素是否动态更改大小;否则,返回浮动对象元素

继承自

FloatingObject.dynamicSize


endColumn

endColumn(value?): any

获取或设置浮动对象元素位置的结束列索引

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 浮动对象元素位置的结束列索引

返回值

any

如果未设置任何值,则返回浮动对象元素位置的结束列索引;否则,返回浮动对象元素

继承自

FloatingObject.endColumn


endColumnOffset

endColumnOffset(value?): any

获取或设置相对于浮动对象元素的结束列的偏移量

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的结束列的偏移量

返回值

any

如果未设置任何值,则返回相对于浮动对象元素的结束列的偏移量;否则,返回浮动对象元素

继承自

FloatingObject.endColumnOffset


endRow

endRow(value?): any

获取或设置浮动对象元素位置的末行索引

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 浮动对象元素位置的末行索引

返回值

any

如果未设置任何值,则返回浮动对象元素位置的末端行索引;否则,返回浮动对象元素

继承自

FloatingObject.endRow


endRowOffset

endRowOffset(value?): any

获取或设置相对于浮动对象元素的最后一行的偏移量

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的最后一行的偏移量

返回值

any

如果未设置任何值,则返回相对于浮动对象元素的最后一行的偏移量;否则,返回浮动对象元素

继承自

FloatingObject.endRowOffset


fixedPosition

fixedPosition(value): any

获取或设置浮动对象元素的位置是否固定 当fixedPosition为true时,dynamicMove和dynamicSize被禁用

代码示例

//本示例将对象的位置设置为固定
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.fixedPosition(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value boolean 该值指示浮动对象元素的位置是否固定

返回值

any

如果未设置任何值,则返回浮动对象元素的位置是否固定 否则,返回浮动对象元素

继承自

FloatingObject.fixedPosition


getHost

getHost(): HTMLElement[]

获取自定义内容的dom宿主

返回值

HTMLElement[]

继承自

FloatingObject.getHost


height

height(value?): any

获取或设置浮动对象元素的高度

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? number 浮动对象元素的高度

返回值

any

如果未设置任何值,则返回一个浮动对象元素的高度;否则,返回浮动对象元素

继承自

FloatingObject.height


isLocked

isLocked(value?): any

获取或设置此浮动对象元素是否被锁定

代码示例

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
customFloatingObject.isLocked(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
activeSheet.options.isProtected = true;

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否被锁定

返回值

any

如果未设置任何值,则返回此浮动对象元素是否被锁定;否则,返回浮动对象元素

继承自

FloatingObject.isLocked


isSelected

isSelected(value?): any

获取或设置是否选择此浮动对象元素

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isSelected(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否被选择

返回值

any

如果未设置任何值,则返回是否选择此浮动对象元素;否则,返回浮动对象元素

继承自

FloatingObject.isSelected


isVisible

isVisible(value?): any

获取或设置此浮动对象元素是否可见

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否可见

返回值

any

如果未设置任何值,则返回此浮动对象元素是否可见;否则,返回浮动对象元素

继承自

FloatingObject.isVisible


itemHeight

itemHeight(value?): any

获取或设置切片器的项高度

代码示例

//This example changes the slicer item height.
//create a table
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);

var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
console.log(slicer.itemHeight()); // 21
slicer.itemHeight(35);
console.log(slicer.itemHeight()); // 35

参数

属性名 类型
value? number

返回值

any

如果没有设置值,返回切片器的项高度;否则,返回切片器


name

name(value?): any

获取或设置切片器的name

参数

属性名 类型
value? string

返回值

any

如果没有设置值,返回切片器的名称;否则,返回切片器

Overrides

FloatingObject.name


refreshContent

refreshContent(): void

刷新floatObject中的内容用户应重写此方法,以使其内容与floatObject同步

返回值

void

继承自

FloatingObject.refreshContent


showHeader

showHeader(value?): any

获取或设置是否显示切片器的标题

代码示例

//This example hides the slicer header.
//create a table
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
//slicer style
var style1 = new GC.Spread.Sheets.Slicers.SlicerStyles.light4();
//add a slicer to the sheet and return the slicer instance.
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.showHeader(false);
slicer.style(style1);

参数

属性名 类型
value? boolean

返回值

any

如果未设置值,则返回是否显示切片器头;否则,返回切片器


showNoDataItems

showNoDataItems(value?): any

获取或设置是显示切片器的无数据项

代码示例

//create a table
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//change the slicer properties.
slicer.showNoDataItems(false);

参数

属性名 类型
value? boolean

返回值

any

如果没有设置值,返回是否显示切片器标题;否则,返回切片器


showNoDataItemsInLast

showNoDataItemsInLast(value?): any

获取或设置是否最后显示无数据项

代码示例

//本示例设置切片器中项的排序顺序
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//change the slicer properties.
slicer.showNoDataItemsInLast(false);

参数

属性名 类型
value? boolean

返回值

any

如果没有设置值,返回是否显示切片器的排序状态;否则,返回切片器


sortState

sortState(value?): any

获取或设置相对于浮动对象元素的起始行的偏移量

代码示例

//This example sets the sort order of the items in the slicer.
//create a table
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
// slicer style
var style1 = new GC.Spread.Sheets.Slicers.SlicerStyles.light4();
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//set slicer properties
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.sortState(GC.Spread.Sheets.SortState.descending);
slicer.style(style1);

参数

属性名 类型
value? SortState

返回值

any

如果未设置值,请返回切片器的排序状态;否则,返回切片器


startColumn

startColumn(value?): any

获取或设置浮动对象位置的起始列索引。

代码示例

//Creates a floating object.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

参数

属性名 类型
value? number

返回值

any

如果未设置值,请返回浮动对象位置的起始列索引;否则,返回浮动对象

继承自

FloatingObject.startColumn


startColumnOffset

startColumnOffset(value?): any

获取或设置相对于浮动对象的开始列的偏移

代码示例

//Creates a floating object.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

参数

属性名 类型
value? number

返回值

any

如果未设置值,请返回相对于浮动对象的开始列的偏移;否则,返回浮动对象

继承自

FloatingObject.startColumnOffset


startRow

startRow(value?): any

获取或设置浮动对象位置的起始行索引。

代码示例

//Creates a floating object.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

参数

属性名 类型
value? number

返回值

any

如果未设置值,请返回浮动对象位置的开始行索引;否则,返回浮动对象

继承自

FloatingObject.startRow


startRowOffset

startRowOffset(value?): any

获取或设置相对于浮动对象的开始行的偏移

代码示例

//This example creates a floating object.
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

参数

属性名 类型
value? number

返回值

any

如果未设置值,请返回相对于浮动对象的开始行返回偏移;否则,返回浮动对象

继承自

FloatingObject.startRowOffset


style

style(value?): any

获取或设置切片器的样式。

代码示例

//This example uses a built-in style.
//create a table
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
// slicer style
var style1 = new GC.Spread.Sheets.Slicers.SlicerStyles.light4();
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//change the slicer properties.
slicer.position(new GC.Spread.Sheets.Point(100, 200));
slicer.style(style1);

参数

属性名 类型 说明
value? SlicerStyle 切片器样式

返回值

any

如果没有设置值,返回是否显示切片器样式;否则,返回切片器

toImageSrc

toImageSrc(): string

获取Base64字符串类型的切片器Image src。

代码示例

let slicerImageSrc = sheet.slicers.all()[0].toImageSrc();

返回值

string

返回切片器图像 Base64 src 字符串。


visuallyNoDataItems

visuallyNoDataItems(value?): any

获取或设置是否在视觉上区分没有数据的项

代码示例

//create a table
var spread = new GC.Spread.Sheets.Workbook('ss');
var activeSheet = spread.getActiveSheet();
datas = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["4", "NewYork", "1964/3/2", "71", "179"],
    ["5", "Washington", "1972/8/8","80", "171"],
    ["6", "Washington", "1986/2/2", "89", "161"],
    ["7", "Washington", "2012/2/15", "71", "240"]];
var table = activeSheet.tables.addFromDataSource("table1", 2, 2, datas);
dataColumns = ["Name", "City", "Birthday", "Weight", "Height"];
table.setColumnName(0, dataColumns[0]);
table.setColumnName(1, dataColumns[1]);
table.setColumnName(2, dataColumns[2]);
table.setColumnName(3, dataColumns[3]);
table.setColumnName(4, dataColumns[4]);
var slicer = new GC.Spread.Sheets.Slicers.DOMTableSlicer('slicer1', table, 'Name');
//change the slicer properties.
slicer.visuallyNoDataItems(false);

参数

属性名 类型
value? boolean

返回值

any

如果没有设置值,返回是否在视觉区分没有数据的项;否则,返回切片器


width

width(value?): any

获取或设置浮动对象元素的宽度

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型
value? number

返回值

any

如果未设置任何值,则返回一个浮动对象元素的宽度;否则,返回浮动对象元素

继承自

FloatingObject.width


x

x(value?): any

获取或设置浮动对象元素的水平位置

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型
value? number

返回值

any

如果未设置任何值,则返回浮动对象元素的水平位置;否则,返回浮动对象元素

继承自

FloatingObject.x


y

y(value?): any

获取或设置浮动对象元素的垂直位置

代码示例

//本示例创建了一个浮动对象
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? number 获取或设置浮动对象元素的垂直位置

返回值

any

如果未设置任何值,则返回浮动对象对象的垂直位置;否则,返回浮动对象元素

继承自

FloatingObject.y