SpreadJS Documentation
isLocked Method
The value that indicates whether this floating object is locked.
Gets or sets whether this floating object is locked.
Syntax
var instance = new GcSpread.Sheets.FloatingObject(name, x, y, width, height);
var returnValue; // Type: Object
returnValue = instance.isLocked(value);
function isLocked( 
   value : boolean
) : Object;

Parameters

value
The value that indicates whether this floating object is locked.

Return Value

true if locked; otherwise, false.
Example
This example creates a floating object. The second example locks a slicer for a table.
var customFloatingObject = new GcSpread.Sheets.CustomFloatingObject("f1");
var start = new GcSpread.Sheets.Point(10, 10);
customFloatingObject.position(start);
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.addFloatingObject(customFloatingObject);
activeSheet.setIsProtected(true);
//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 table = activeSheet.addTableByDataSource("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 GcSpread.Sheets.SlicerStyles.light4();
//add a slicer to the sheet and return the slicer instance.
var slicer = activeSheet.addSlicer("slicer1",table.name(),"Height");
 //change the slicer properties.
slicer.position(new GcSpread.Sheets.Point(100, 200));
slicer.isLocked(true);
activeSheet.setIsProtected(true);
slicer.style(style1);
See Also

Reference

FloatingObject class

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.