Managing Sheet with APIs

SheetAPI.createSheetWin



SheetAPI.createSheetApp method is used to create a window instance contains the sheet application and return the handle information. This is the first API need to be called in your file.

SHEET_API.createSheetWin( sheetConfig, winConfig )

Parameters The configuration object defines the parameters to show/hide the different elements of the sheet application. Those elements include TitleBar, SheetBar, ToolBar, ContentBar and SideBar.
{
       withoutTitlebar: true,
       withoutSheetbar: true,
       withoutToolbar: true,
       withoutContentbar: true,
       withoutSidebar: true   
}

See the following image for the bar definition in the sheet panel.



Returns

The handle information of the Sheet application just created

{
       appCt: the container of the sheet application, which contains the sheet and some toolbar
       sheet: the sheet itself
       store: the store of sheet application 
}

You can also create your own Ext.window.Window without call this method. This will be give more flexible to process your method. For detail, please see document Render Sheet UI in popup window

Example code


Ext.onReady(function(){
    SCONFIG.setupDir('');
            
    // define Global variable, you can use them in your code.
    SHEET_API = Ext.create('EnterpriseSheet.api.SheetAPI', {
        openFileByOnlyLoadDataFlag: true
    });
    SHEET_API_HD = SHEET_API.createSheetApp({
        withoutTitlebar: true,
        withoutSheetbar: true,
        withoutToolbar: true,
        withoutContentbar: true,
        withoutSidebar: true  
    });
            
    var win;
    POP_SHEET_WIN = function(){
        if(!win){
            win = Ext.create('Ext.window.Window', {
                resizable : true,
                modal: true,
                buttonAlign : "right",
                closable : true,
                closeAction : 'hide',
                width : 1000,
                height: 600,
                layout : 'fit',
                items: [SHEET_API_HD.appCt],
                buttons: [{
                    text: 'Close',
                    handler: function(){
                        win.hide();
                    }
                },{
                    text: 'Submit',
                    handler: function(){
                        var json = SHEET_API.getJsonData(SHEET_API_HD);
                        alert(Ext.encode(json));
                    }
                }]
            });
        }
        win.show();

        /*
         * normally we suggest call loadData to initial data after the sheet is rendered.
         */
        var b2CellValue = document.getElementById("cellValue").value;
        var json = {
            fileName:"Basic file",
            sheets:[{id:1,name:"First",actived:true,color:"orange"},{id:2,name:"Second"}],
            cells:[{i:1,x:2,y:2,j:"{data: \"" + b2CellValue + "\"}"}]
        };
        SHEET_API.loadData(SHEET_API_HD, json);
    }
});
    

 

 


Copyright © FeyaSoft Inc. All rights reserved.