[]
Follow the below steps to add a new item to the Designer Component File Menu.
Get the File Menu panel template using the getTemplate method.
var fileMenuTemplate = GC.Spread.Sheets.Designer.getTemplate(GC.Spread.Sheets.Designer.TemplateNames.FileMenuPanelTemplate);
Modify the File Menu panel template to add a custom item and related options.
var listContainer = fileMenuTemplate["content"][0]["children"][0]["children"][0]["children"][0]["children"][1];
listContainer.items.push({ text: "Info", value: "CustomItem" });
var listDisplayContainer = fileMenuTemplate["content"][0]["children"][0]["children"][1];
listDisplayContainer.children.push({
type: "Container",
visibleWhen: "activeCategory_main=CustomItem",
children: [
{
type: "TextBlock",
margin: "50px 0 15px 50px",
text: "Info",
style: "font-size:36px;line-heigth:80px"
},
{
type: "ColumnSet",
margin: "0 0 0 50px",
children: [
{
type: "Column",
children: [
{
type: "List",
className: "file-menu-list",
items: [
{
text: "SpreadJS Version xx.x",
value: "item1"
},
{ text: "Release Date: September 22", value: "Item2" },
{ text: "Author: GrapeCity Inc.", value: "Item3" }
],
bindingPath: ""
}
],
width: "350px"
}
]
}
]
});
Register the modified template using the registerTemplate method.
GC.Spread.Sheets.Designer.registerTemplate(GC.Spread.Sheets.Designer.TemplateNames.FileMenuPanelTemplate, fileMenuTemplate);
Initialize the designer instance by passing the relevant config parameter for customizable configuration.
// Initialize the designer instance
var designer = new GC.Spread.Sheets.Designer.Designer(document.getElementById("designerHost"));
The below output will be generated: