@Script Developers:
@Script Developers:
Does anyone have an idea how to reliably track down an item in Lightning even if it might’ve been moved to other containers?
(Context: I want to update my music widget instead of having the user recreate it after an update https://plus.google.com/+LukasMorawietz/posts/QVm3e4Xpwfq)
]]>
< ![CDATA[
Assuming the user doesn’t delete the widget and then adds a new item which would get the same id, you can use LL.getItemById() to get an item in any container
]]>
< ![CDATA[
Colin de Roos
Sadly, Ids will change if the item is moved to a different container.
]]>
< ![CDATA[
Oh really?! Didn’t know that. Sorry. The next best thing i can think of is running a script on the resumed event to tell the app where it is
]]>
< ![CDATA[
The resumed event seems the best.
Maybe: make it so that the widget itself keeps a copy of its id, and if it detects that the id has changed it sends the new id to the manager.
]]>
< ![CDATA[
Maybe I can use the container id, it shouldn’t change… I have to test that
]]>
< ![CDATA[
I confirm container ids never change, except when imported from a template but that’s not an issue here.
Maybe what you could do is set a unique name or tag with a random UUID, but still there need to be a recursive search to find an item by name or tag value.
]]>