[]
• new ItemSlicer(name
, slicerData
, columnName
)
Represents an item slicer.
example
//This example creates an item slicer.
//create table
var dataSource = [
{ Name: "Bob", City: "NewYork", Birthday: "1968/6/8" },
{ Name: "Betty", City: "NewYork", Birthday: "1972/7/3" },
{ Name: "Alice", City: "Washington", Birthday: "2012/2/15" },
];
var table = activeSheet.tables.addFromDataSource("table1", 1, 1, dataSource);
var slicerData = new GC.Spread.Sheets.Slicers.TableSlicerData(table)
//Set slicer data to item slicer.
var slicer = new GC.Spread.Sheets.Slicers.ItemSlicer("slicer", slicerData, "Name");
//Add the item slicer to the dom tree.
//The "slicerHost" is the div you want to add the slicer's dom to.
$("#slicerHost").append(slicer.getDOMElement());
Name | Type | Description |
---|---|---|
name |
string |
The name of the item slicer. |
slicerData |
GeneralSlicerData |
An instance of the GeneralSlicerData or TableSlicerData. |
columnName |
string |
The column name that relates to the item slicer. |
▸ captionName(value?
): any
Gets or sets the caption name of the item slicer.
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the caption name of the item slicer; otherwise, returns the item slicer.
▸ columnCount(value?
): any
Gets or sets the column count of the item slicer.
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the column count of the item slicer; otherwise, returns the item slicer.
▸ getDOMElement(): HTMLElement
Gets the dom element of the item slicer.
HTMLElement
The dom element of the item slicer.
▸ height(value?
): any
Gets or sets the height of the item slicer.
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the height of the item slicer; otherwise, returns the item slicer.
▸ itemHeight(value?
): any
Gets or sets the item height of the item slicer.
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the item height of the item slicer; otherwise, returns the item slicer.
▸ name(value?
): any
Gets or sets the name of the item slicer.
Name | Type |
---|---|
value? |
string |
any
If no value is set, returns the name of the item slicer; otherwise, returns the item slicer.
▸ showHeader(value?
): any
Gets or sets whether to show the header of the item slicer.
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether to show the header of the item slicer; otherwise, returns the item slicer.
▸ showNoDataItems(value?
): any
Gets or sets whether to show the no data items of the item slicer.
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether to show the no data items of the item slicer; otherwise, returns the item slicer.
▸ showNoDataItemsInLast(value?
): any
Gets or sets whether to show the no data items last.
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether to show the no data items last; otherwise, returns the item slicer.
▸ sortState(value?
): any
Gets or sets the sort state of the item slicer.
Name | Type |
---|---|
value? |
SortState |
any
If no value is set, returns the sort state of the item slicer; otherwise, returns the item slicer.
▸ style(value?
): any
Gets or sets the style of the item slicer.
example
The style is json data, its json schema is as follows:
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"title" : "style",
"type" : "object",
"properties" : {
"wholeSlicerStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"headerStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"selectedItemWithDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"selectedItemWithNoDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"unSelectedItemWithDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"unSelectedItemWithNoDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"hoveredSelectedItemWithDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"hoveredSelectedItemWithNoDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"hoveredUnSelectedItemWithDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
},
"hoveredUnSelectedItemWithNoDataStyle" : {
"$ref" : "#/definitions/StyleInfo"
}
},
"definitions" : {
"StyleInfo" : {
"type" : "object",
"properties" : {
"backColor" : {
"type" : "string"
},
"foreColor" : {
"type" : "string"
},
"font" : {
"type" : "string"
},
"borderLeft" : {
"$ref" : "#/definitions/SlicerBorder"
},
"borderTop" : {
"$ref" : "#/definitions/SlicerBorder"
},
"borderRight" : {
"$ref" : "#/definitions/SlicerBorder"
},
"borderBottom" : {
"$ref" : "#/definitions/SlicerBorder"
},
"textDecoration":{
"type" : "string"
}
}
},
"SlicerBorder":{
"type":"object",
"properties":{
"borderWidth":{
"type":"number"
},
"borderStyle":{
"type":"string"
},
"borderColor":{
"type":"string"
}
}
}
}
}
Name | Type | Description |
---|---|---|
value? |
any |
The style of the item slicer. |
any
If no value is set, returns The style of the item slicer; otherwise, returns the item slicer.
▸ visuallyNoDataItems(value?
): any
Gets or sets whether to visually distinguish the items with no data.
Name | Type |
---|---|
value? |
boolean |
any
If no value is set, returns whether to visually distinguish the items with no data; otherwise, returns the item slicer.
▸ width(value?
): any
Gets or sets the width of the item slicer.
Name | Type |
---|---|
value? |
number |
any
If no value is set, returns the width of the item slicer; otherwise, returns the item slicer.