不知道为什么会发生返回意外错误:
我正在尝试编辑字幕面板,但如果我制作“返回应用程序”,则会出现错误。我的功能面板管理员创建我的标题面板,我的功能 createActivatePanelAdmin 获取标题面板并尝试编辑内容,因为如果选择了一个项目栏,标题面板的内容必须更改。
function panelAdmin(){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById(LOGS_SHEET_ID);
var verticalPanelAdmin = app.createVerticalPanel().setId("verticalPanelAdmin");
var mainPanelIndex = app.createCaptionPanel().setText("Index");
var menuBar = app.createMenuBar().setId("menuBar").setAnimationEnabled(true);//For vertical menubar(true)
var hdPanelAdminIndex = app.createServerHandler("createPanelAdminIndex").addCallbackElement(mainPanelIndex);
var hdPanelCreateUserPanel = app.createServerHandler("createUserPanelAdmin").addCallbackElement(mainPanelIndex);
var hdPanelActive = app.createServerHandler("createActivatePanelAdmin").addCallbackElement(mainPanelIndex);
var hdPanelDeleteUserPanel = app.createServerHandler("deleteUserPanel").addCallbackElement(mainPanelIndex);
var hdPanelSearchUserPanel = app.createServerHandler("searchUserPanel").addCallbackElement(mainPanelIndex);
var hdPanelExitUserPanel = app.createServerHandler("ExitUserPanel").addCallbackElement(mainPanelIndex);
var menuItem0 = app.createMenuItem('Inicio ', hdPanelAdminIndex);
var menuItem1 = app.createMenuItem('Crear Usuarios', hdPanelCreateUserPanel);
var menuItem2 = app.createMenuItem('Activar Usuarios', hdPanelActive);
var menuItem3 = app.createMenuItem('Borrar Usuarios', hdPanelDeleteUserPanel);
var menuItem4 = app.createMenuItem('Buscar', hdPanelSearchUserPanel);
var menuItem5 = app.createMenuItem('Salir', hdPanelExitUserPanel);
//top level menu items
//create menuItem separators
var separator0 = app.createMenuItemSeparator();
var separator1 = app.createMenuItemSeparator();
var separator2 = app.createMenuItemSeparator();
var separator3 = app.createMenuItemSeparator();
var separator4 = app.createMenuItemSeparator();
var separator5 = app.createMenuItemSeparator();
//Add the menu item separators and menuItem to the MenuBar
menuBar.addSeparator(separator0).addItem(menuItem0).addSeparator(separator1)
.addItem(menuItem1).addSeparator(separator2)
.addItem(menuItem2).addSeparator(separator3)
.addItem(menuItem3).addSeparator(separator4)
.addItem(menuItem4).addSeparator(separator5)
.addItem(menuItem5).addSeparator(separator0);
verticalPanelAdmin.add(menuBar);
verticalPanelAdmin.add(mainPanelIndex);
app.add(verticalPanelAdmin);
return app;
};
function createActivatePanelAdmin(){
var ss = SpreadsheetApp.openById(LOGS_SHEET_ID);
var app = UiApp.getActiveApplication();
var verticalPanelAdmin = app.getElementById("verticalPanelAdmin");
var menuBar = app.getElementById("menuBar");
var mainPanelIndex = app.getElementById("mainPanelIndex");
mainPanelIndex.setText("Sistema de creación de usuarios");
var mainPanelActivateAdmin = app.createHorizontalPanel().setId("mainPanelActivateAdmin");
/*FROM HERE WORKS CORRECTLY (TESTED)*/
var lastCol = ss.getLastColumn();
var rowsToConfirm = confirmReg();
var lastRow = numRows(rowsToConfirm);
if (rowsToConfirm != null){
var flexTableRegAdmin = app.createFlexTable().setId("flexTableRegAdmin").setBorderWidth(1);
flexTableRegAdmin.setText(0, 0, "ID");
flexTableRegAdmin.setText(0, 1, "NOMBRE");
flexTableRegAdmin.setText(0, 2, "PASS");
flexTableRegAdmin.setText(0, 3, "EMAIL");
flexTableRegAdmin.setText(0, 4, "ESTADO");
flexTableRegAdmin.setText(0, 5, "ACTIVAR");
var check = new Array(lastRow);
for(var r = 0; r < lastRow; r++){
for(var c = 0; c < lastCol; c++){
var text = rowsToConfirm[r][c].toString();
flexTableRegAdmin.setText(r+1, c, text);
}
var id = rowsToConfirm[r][0];
check[r] = app.createCheckBox().setName("chk_"+id).setId("chk_"+id);
flexTableRegAdmin.setWidget(r+1, lastCol, check[r]);
}//end fors
}//end if
var botMod = app.createButton().setText("Activar").setId("botStatus");
var botHandle = app.createServerHandler("changeStatus").addCallbackElement(mainPanelActivateAdmin);
botMod.addClickHandler(botHandle);
/*TO HERE*/
mainPanelActivateAdmin.add(flexTableRegAdmin);
mainPanelActivateAdmin.add(botMod);
mainPanelIndex.add(mainPanelActivateAdmin);
return app;
};
**感谢帮助!而且我不得不说 flextable 没问题,我是在其他站点上构建的,所以不要花时间尝试查看错误是否在 Flextable 或 botton_send 中**
问题出在面板中(我试图清除代码)
编辑:(我只是想删除标题面板,但我不能。意外错误)
function createActivatePanelAdmin(){
var app = UiApp.getActiveApplication();
var verticalPanelAdmin = app.getElementById("verticalPanelAdmin");
var mainPanelIndex = app.getElementById("mainPanelIndex");
verticalPanelAdmin.remove(mainPanelIndex);
return app;
};