SpreadJS Documentation
GC.Spread.Sheets.FloatingObjects Namespace / FloatingObjectCollection type / zIndex Method
The name of the floatingObject.
The z-index of the floating object.
In This Topic
    zIndex Method
    In This Topic
    Gets or sets the z-index of floating object.
    Syntax
    var instance = new GC.Spread.Sheets.FloatingObjects.FloatingObjectCollection(sheet, typeName);
    var value; // Type: any
    value = instance.zIndex(name, zIndex);
    function zIndex( 
       name : string,
       zIndex : number
    ) : any;

    Parameters

    name
    The name of the floatingObject.
    zIndex
    The z-index of the floating object.
    Example
    The following examples use the zIndex method.
    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);
    var customFloatingObject1 = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f2", 10, 30, 60, 64);
    var btn1 = document.createElement('button');
    btn1.style.width = "50px";
    btn1.style.height = "20px";
    btn1.innerText = "test";
    customFloatingObject1.content(btn1);
    activeSheet.floatingObjects.add(customFloatingObject1);
    alert(activeSheet.floatingObjects.zIndex("f1"));
    var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 20, 20, 60, 64);
    var btn = document.createElement('button');
    btn.style.width = "60px";
    btn.style.height = "30px";
    btn.innerText = "button1";
    customFloatingObject.content(btn);
    activeSheet.floatingObjects.add(customFloatingObject);
     
    var customFloatingObject1 = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f2", 5, 5, 30, 64);
    var btn1 = document.createElement('button');
    btn1.style.width = "60px";
    btn1.style.height = "30px";
    btn1.innerText = "button2";
    customFloatingObject1.content(btn1);
    activeSheet.floatingObjects.add(customFloatingObject1);
    activeSheet.floatingObjects.zIndex("f2", 897);
    activeSheet.floatingObjects.zIndex("f1", 898);
    See Also