Right now the siteId gets set to the id of the element you pass to newGadgetSite (or the next sequence number if not provided). We are using the siteId to correlate to our gadgetId, so that when user_prefs is called (one of the parameters is the siteId) we can use that to store/retrieve data on behalf of the gadget. The way our database is constructed this gadgetId is numeric.
As a quick implementation I set our element id to app-# and strip off the app- in our prefs implementation. That works, but is very clunky. So then I thought I¹d plug into the onConstructed calls for GadgetSite or GadgetHolder, but the order of events doesn¹t seem to allow this, because in GadgetSite it¹s too early to access the gadget and in GadgetHolder it¹s too late because the site array has been setup. I tried overriding osapi.container.Container.prototype.newGadgetSite and then set a siteId attribute on my html element that I used in the overridden function, but I really don¹t like this either (I¹m just trading off one attribute for another). Since the siteId is only used as a communication mechanism, is it ok that it is just a number? My concern of having an id as just a number was collision with other dom items, but maybe this isn¹t really an issue and I¹m going to too much work to solve this. I don¹t know if the common container spec is set in concrete, but a newGadgetSite that takes a gadget might be a good solution too. Ideas? Doug
