1

我似乎无法让 SplitLayoutPanel 显示它的子元素。如文档中所述,GAS 似乎支持此类。

https://developers.google.com/apps-script/class_splitlayoutpanel

这是我对代码的尝试。任何建议将不胜感激。我的假设是这为用户提供了一个拆分器,他们可以拖动它来调整面板的大小(这非常适合我的目标。左侧面板和右侧面板具有更多细节。

        function doGet(e) { 
  var app = UiApp.createApplication();
  //code goes here   

  var mainPanel = app.createSplitLayoutPanel().setId('mainPanel')
    .setVisible(true);
  app.add(mainPanel);

   var eastPanel = app.createVerticalPanel().setId('eastPanel');
  eastPanel.add(app.createLabel('eastPanel loaded'));
  mainPanel.addEast(eastPanel, 500);

  var westPanel = app.createVerticalPanel().setId('westPanel');
  westPanel.add(app.createLabel('westPanel loaded'));
  mainPanel.addWest(westPanel, 500);


  return app;
}

我错过了什么?

4

1 回答 1

1

mainPanel.setSize('100%', '100%');遗漏了一行。以下代码有效。

function doGet(e) { 
  var app = UiApp.createApplication();
  //code goes here   

  var mainPanel = app.createSplitLayoutPanel().setId('mainPanel')
    .setVisible(true);
  mainPanel.setSize('100%', '100%');
  app.add(mainPanel);

   var eastPanel = app.createVerticalPanel().setId('eastPanel');
  eastPanel.add(app.createLabel('eastPanel loaded'));
  mainPanel.addEast(eastPanel, 500);

  var westPanel = app.createVerticalPanel().setId('westPanel');
  westPanel.add(app.createLabel('westPanel loaded'));
  mainPanel.addWest(westPanel, 500);

  return app;
}
于 2012-08-13T19:55:49.393 回答