我想知道如何设置“blocksPanel”和“briquettesPanel”可见或不可见?如果在下拉列表中选择了“8:1 Compressed Blocks”,我希望“blocksPanel”可见,如果在下拉列表中选择“8:1 Compressed Briquettes”,则“briquettesPanel”可见。
function doGet(e) {
var app = UiApp.createApplication();
//Create horizontal product + other panel
var productOtherPanel = app.createHorizontalPanel().setId('productOtherPanel')
.setStyleAttribute('position','relative').setStyleAttribute('left','0%');
//Create horizontal Product Panel
var productPanel = app.createHorizontalPanel().setId('productPanel').setStyleAttribute('position','relative')
.setStyleAttribute('left','0%').setVisible(true);
//Create listBox
var productList = app.createListBox().setName("productList").setId('productList');
//Add items to listBox
productList.addItem("8:1 Compressed Blocks");
productList.addItem("8:1 Compressed Briquettes");
//Create horizontal Compressed Blocks panel
var blocksPanel = app.createHorizontalPanel().setId('blocksPanel')
.setStyleAttribute('position','relative').setStyleAttribute('left','0%').setVisible(true);
//Create Compressed Blocks Size List
var blocksSizeList = app.createListBox().setName('blocksSizeList').setId('blocksSizeList');
//addItem fills the Compressed Blocks Size List
blocksSizeList.addItem("5kg");
blocksSizeList.addItem("20kg");
//Create horizontal Briquettes panel
var briquettesPanel = app.createHorizontalPanel().setId('briquettesPanel')
.setStyleAttribute('position','relative').setStyleAttribute('left','0%').setVisible(true);
//Create Briquettes Size List
var briquettesSizeList = app.createListBox().setName('briquettesSizeList').setId('briquettesSizeList');
//addItem fills the Briquettes Size List
briquettesSizeList.addItem("250g");
briquettesSizeList.addItem("650g");
app.add(productOtherPanel);
productOtherPanel.add(productPanel);
productPanel.add(productList);
productOtherPanel.add(blocksPanel);
blocksPanel.add(blocksSizeList);
productOtherPanel.add(briquettesPanel);
briquettesPanel.add(briquettesSizeList);
return app;
}