Struggling to set up 3 list boxes that populate based on each other? At the moment, I have one list box fetching data from a spreadsheet. Could someone assist me in configuring it so that the second list box populates based on the first, and a third list box populates based on the second one? Below is the code snippet:
function doGet(e){
var app = UiApp.createApplication();
var mainPage = app.createVerticalPanel().setId('mainPage');
var dataItemsLB = app.createListBox().setId('dataItemsLB').setName('dataItemsLB');
var dataItemsLbl = app.createLabel('Data Items');
dataItems(dataItemsLB);
mainPage.add(dataItemsLB);
app.add(mainPage);
return app;
}
function dataItems(listbox){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('0AhraBJOts4V3dDhYbERTR0hFNUtNdEhZd2c4OElpY0E');
var list = ss.getSheetByName('dataItems');
var values = list.getRange(1,1,ss.getLastRow(),1).getValues();
for (var i in values){
listbox.addItem(values[i][0].toString());
}
return app;
}
The above code snippet only covers populating one list box. However, starting from the basics will help me grasp the concept better as you explain. Appreciate any guidance!