2012-06-28 46 views

回答

1

你將不得不通過列表框控件低谷服務器端調用來獲取選定的數據出來吧:

function doGet(){ 
    var app = UiApp.createApplication(); 
    var lb = app.createListBox(); 
    lb.setName("calName") //name used to fetch selected result 
    .addItem("Text Option One", "1")//options for selection 
    .addItem("Text Option Two","");//first peram display text and second peram value 
    app.add(lb); // adds listbox to display 
    app.add(app.createButton("Click Me")//create button 
     .addClickHandler(app.createServerHandler("showResult") // Create server side execution to handel click 
          .addCallbackElement(lb))); // add list-boxas element to be passed to server as parameter 
return app; 
} 

function showResult(e){ 
    var app = UiApp.getActiveApplication(); 
    var res = e.parameter.calName;//parameter name same as list-box name given 
    app.add(app.createLabel("Selected option is " + res));//displays selected option 
    return app; 
} 

剛剛創建測試應用程序並保存一個版本,使用該代碼的應用程序和部署完成後查看最新的代碼。