Calvin Ong
Calvin Ong

Reputation: 77

Dynamic gadget size (Google Apps Script)

I have created a gadget (10 treeitems with content) using Google Apps Script.

After I created 10 treeitems with content, I realise that I have to manually set the size of gadget to 7000 pixels in order to display all the content (if I expand all the treeitems).

May I know is there any way/ is it possible to make the size of gadget flexible/dynamic based on action taken (e.g. : size of gadget will change when treeitems is expanded )?

Upvotes: 0

Views: 463

Answers (1)

fullOfGAS
fullOfGAS

Reputation: 588

Instead of resizing your gadget, why not add the tree to a scroll panel, then I don't think it will matter how big the tree gets because users can use the scroll bars to view it.

function doGet(e) {

  var app = UiApp.createApplication();
  var tree = app.createTree();
  var scroll = app.createScrollPanel(tree).setWidth(800);

  //Add items to your tree

  app.add(scroll);
  return app;
}

Upvotes: 1

Related Questions