Reputation: 1335
I'm trying to change an element's id in response to an event but I can't seem to get it to work. I have created a simplified example of what I'm trying to do below.
function handleEvent(e) {
var app = UiApp.getActiveApplication();
app = changeId_(app, 0, 1);
return app;
}
function changeId_(app, idOld, idNew) {
app.getElementById(idOld + "element").setId(idNew + "element");
return app;
}
I'm just wondering if it is actually possible to do as I can't think of what is wrong with the code.
Upvotes: 0
Views: 114
Reputation: 3700
You should be able to use a grid and replace elements in the grid. When you replace elements in the grid, you can use a new ID for the new element/"widget". In my case, I repopulate the entire grid to make the code simple, but I think can replace a single element.
Take care with widget IDs, if you reuse an old ID for a new widget, then ensure the widget type of the old and new widget are the same.
Upvotes: 1
Reputation: 7957
I don't think it is possible. But why would you want to do that ? If you can give the use case, maybe there is an alternative that the community can help you with.
Upvotes: 1