我构建了这个脚本,在迭代文件夹的文件后,创建一个UI,将文件显示为复选框列表:
function showList(folderID) {
var folder = DocsList.getFolderById(folderID);
var files = folder.getFiles();
arrayList = [];
for (var file in files) {
Logger.log("file = " + file);
file = files[file];
var fileName = file.getName();
var fileId = file.getId();
var newArray = [fileName, "some info", fileId];
arrayList.push(newArray);
}
var mydoc = SpreadsheetApp.getActiveSpreadsheet();
var app = UiApp.createApplication();
var panel = app.createVerticalPanel().setId('panel');
panel.add(app.createHidden('checkbox_total', arrayList.length));
for(var i = 0; i < arrayList.length; i++){
var checkbox = app.createCheckBox().setName('checkbox_isChecked_'+i).setText(arrayList[i][0]);
panel.add(checkbox);
}
var handler = app.createServerHandler('submit').addCallbackElement(panel);
panel.add(app.createButton('Submit', handler));
app.add(panel);
mydoc.show(app);
}
我的问题:文件数量很大,并且未显示面板的submit
按钮。怎么处理这个?如何添加滚动条会显示submit
按钮?
答案 0 :(得分:0)
好的,这很容易。挖掘我解决的文档。您只需构建一个滚动面板并将之前的面板添加到其中:
var scroll = app.createScrollPanel().setPixelSize(800, 800);
scroll.add(panel);
app.add(scroll);
// app.add(panel);
mydoc.show(app);