SpreadJS Documentation
selectedItemWithDataStyle Method
The style of the selected item with data.
Gets or sets the style of the selected item with data.
Syntax
var instance = new GcSpread.Sheets.SlicerStyle();
var value; // Type: SlicerStyleInfo
value = instance.selectedItemWithDataStyle(item);
function selectedItemWithDataStyle( 
   item : SlicerStyleInfo
) : SlicerStyleInfo;

Parameters

item
The style of the selected item with data.

Return Value

Returns the style of the selected item with data.
Example
This example uses the selectedItemWithDataStyle method.
var datasource = [
    { Name: "Apple", Category: "Fruit" },
    { Name: "Orange", Category: "Fruit" },
    { Name: "Broccoli", Category: "Vegetable" },
    { Name: "Kiwi", Category: "Fruit" },
    { Name: "Rice", Category: "Cereal" },
    { Name: "Strawberry", Category: "Fruit" },
    { Name: "Yogurt", Category: "Dairy" },
    { Name: "Plum", Category: "Fruit" },
    { Name: "Celery", Category: "Vegetable" },
    { Name: "Grape", Category: "Fruit" },
    { Name: "Oats", Category: "Cereal" },
    { Name: "Quinoa", Category: "Cereal" },
    { Name: "Maize", Category: "Cereal" },
    { Name: "Okra", Category: "Vegetable" },
    { Name: "Corn", Category: "Vegetable" },
    { Name: "Wheat", Category: "Cereal" },
    { Name: "Barley", Category: "Cereal" },
    { Name: "Cream", Category: "Dairy" },
    { Name: "Millet", Category: "Cereal" },
    { Name: "Rye", Category: "Cereal" },
    { Name: "Artichoke", Category: "Vegetable" },
    { Name: "Buckwheat", Category: "Cereal" },
    { Name: "Gooseberry", Category: "Fruit" },
    { Name: "Amaranth", Category: "Cereal" },
    { Name: "Carrot", Category: "Vegetable" },
    { Name: "Cheese", Category: "Dairy" },
    { Name: "Fig", Category: "Fruit" },
    { Name: "Milk", Category: "Dairy" },
    { Name: "Butter", Category: "Dairy" },
               ];

var table = activeSheet.addTableByDataSource("table1", 1, 1, datasource);
//add a slicer to the sheet and return the slicer instance.
var slicer = activeSheet.addSlicer("slicer1",table.name(),"Category");
 //change the slicer properties.
slicer.width(200);
slicer.height(200);
slicer.position(new GcSpread.Sheets.Point(300, 50));

var hstyle = new GcSpread.Sheets.SlicerStyleInfo();
hstyle.backColor("red");
hstyle.borderBottom(new GcSpread.Sheets.SlicerBorder(3, "dashed", "green"));
var hstyle1 = new GcSpread.Sheets.SlicerStyleInfo();
hstyle1.borderTop(new GcSpread.Sheets.SlicerBorder(2, "dashed", "blue"));
hstyle1.backColor("yellow");
var hstyle2 = new GcSpread.Sheets.SlicerStyleInfo();
hstyle2.backColor("green");

var style1 = new GcSpread.Sheets.SlicerStyle();
style1.hoveredSelectedItemWithDataStyle(hstyle);
style1.hoveredUnSelectedItemWithDataStyle(hstyle);
style1.unSelectedItemWithDataStyle(hstyle1);
style1.selectedItemWithDataStyle(hstyle2);
slicer.style(style1);

activeSheet.getColumn(1).width(100);
activeSheet.getColumn(2).width(100);
activeSheet.getColumn(3).width(100);
See Also

Reference

SlicerStyle type

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.