找回密码
 立即注册

QQ登录

只需一步,快速开始

sumyy

注册会员

11

主题

43

帖子

122

积分

注册会员

积分
122

[已处理] 排列问题

sumyy
注册会员   /  发表于:2023-6-15 21:24  /   查看:658  /  回复:1
image.png321429442.png image.png298075255.png ,这种沿X轴排列几个按钮的该如何实现?

1 个回复

倒序浏览
Joestar.XuSpreadJS 开发认证
超级版主   /  发表于:2023-6-16 10:36:21
来自 2#
您好,请参考以下代码:

image.png612405089.png

  1. window.onload = function () {
  2.   let designerConfig = JSON.parse(
  3.     JSON.stringify(GC.Spread.Sheets.Designer.DefaultConfig)
  4.   );

  5.   designerConfig.commandMap = {
  6.     menu: {
  7.       text: "菜单",
  8.       title: "菜单",
  9.       bigButton: "=ribbonHeight>toolbarHeight",
  10.       commandName: "menu",
  11.       direction: '=IF(ribbonHeight<toolbarHeight,"horizontal","vertical")',
  12.       dropdownListItemType: "menuitemradio",
  13.       // enableContext: "",
  14.       iconClass: "ribbon-button-formattable",
  15.     },
  16.     list: {
  17.       commandName: "list",
  18.       // enableContext: "",
  19.       execute(context, propertyName, checked) {
  20.         console.log("execute");
  21.         console.log(context);
  22.         console.log(propertyName);
  23.         console.log(checked);
  24.       },
  25.       getState(context, propertyName) {
  26.         console.log("getState");
  27.         console.log(context);
  28.         console.log(propertyName);
  29.       },
  30.       listContent: [
  31.         {
  32.           commandName: "list",
  33.           groupItems: [
  34.             {
  35.               iconClass: "table-format-light0",
  36.               iconHeight: 48,
  37.               iconWidth: 64,
  38.               tip: "Item1",
  39.               value: "light0",
  40.             },
  41.             {
  42.               iconClass: "table-format-light0",
  43.               iconHeight: 48,
  44.               iconWidth: 64,
  45.               tip: "Item1",
  46.               value: "light0",
  47.             },
  48.             {
  49.               iconClass: "table-format-light1",
  50.               iconHeight: 48,
  51.               iconWidth: 64,
  52.               tip: "Item1",
  53.               value: "light0",
  54.             },
  55.             {
  56.               iconClass: "table-format-light1",
  57.               iconHeight: 48,
  58.               iconWidth: 64,
  59.               tip: "Item1",
  60.               value: "light0",
  61.             },
  62.             {
  63.               iconClass: "table-format-light2",
  64.               iconHeight: 48,
  65.               iconWidth: 64,
  66.               tip: "Item1",
  67.               value: "light0",
  68.             },
  69.             {
  70.               iconClass: "table-format-light2",
  71.               iconHeight: 48,
  72.               iconWidth: 64,
  73.               tip: "Item1",
  74.               value: "light0",
  75.             },
  76.             {
  77.               iconClass: "table-format-light3",
  78.               iconHeight: 48,
  79.               iconWidth: 64,
  80.               tip: "Item1",
  81.               value: "light0",
  82.             },
  83.             {
  84.               iconClass: "table-format-light3",
  85.               iconHeight: 48,
  86.               iconWidth: 64,
  87.               tip: "Item1",
  88.               value: "light0",
  89.             },
  90.           ],
  91.           groupName: "List One",
  92.           wrap: false,
  93.         },
  94.       ],
  95.       maxWidth: 550,
  96.       type: "listContent",
  97.     },
  98.   };

  99.   designerConfig.ribbon[0].buttonGroups.push({
  100.     label: "测试",
  101.     thumbnailClass: "ribbon-thumbnail-styles",
  102.     commandGroup: {
  103.       children: [
  104.         {
  105.           children: ["list"],
  106.           command: "menu",
  107.           dropdownMaxWidth: 550,
  108.           type: "dropdown",
  109.         },
  110.       ],
  111.     },
  112.   });

  113.   let designer = new GC.Spread.Sheets.Designer.Designer(
  114.     "gc-designer-container",
  115.     designerConfig
  116.   );

  117.   let spread = designer.getWorkbook();
  118.   
  119.   let sheet = spread.getActiveSheet();
  120. };
复制代码
SpreadJS 17.0.8 | GcExcel 7.1.0 已发布~
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部