[Seaside] How to control ID of a component?

Lukas Renggli renggli at gmail.com
Thu Dec 6 17:46:51 UTC 2007


> I can't do these IDs statically e.g. I may have lots of these on a page.

What about creating an unique ID for each component and store that in
an instance variable?

    '_' , SmallInteger maxVal atRandom asString

makes quite a nice ID. Also WAExternalID from Seaside generates nice
IDs that are very unlikely to collide.

If you don't want to waste any space, you could also use the
#identityHash of the object. In Squeak this is not particularly safe
to do, but in GemStone the OOP gives an ideal and free DOM ID for your
objects.

Cheers,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list