What steps will reproduce the problem?
- Create a MenuBar object (createMenuBar)
- Create a Server Handler point to menuHandler function (createServerHandler)
- Add an item to MenuBar object with the parameters: Name and Handler object;
What is the expected output? What do you see instead?
At the handler function is expected that the parameter return the name of source object that was clicked. Now I see a null value.
On which browser & OS?
Chrome 19.0.1084.56 m
Windows 7 SP1 x64
Please provide any additional information below.
function buildMenu() {
var app = UiApp.createApplication();
var myRootMenu = app.createMenuBar(false);
var txtTest = app.createTextBox().setText("test").setId("txtTest");
var myHandler = app.createServerHandler("menuHandler").addCallbackElement(txtTest);
myRootMenu.addItem("File", myHandler );
app.add(myRootMenu);
return app;
}
function menuHandler(e) {
Logger.log(e);
}
The logging output is:
{parameter=null}
First : this is not an issue tracker, please post what you think are issues where it should be
Second : if you don’t add any callBackElement to a serverhandler it cannot return any value. Please read the docs carefully.
Edit : following your comment :
the value returned by the CallBackElement is linked to its name, so your code should be like this :
Here is a working example :