zkzul

Can I autogenerate ID's with ZK?


My problem is that I implement multiple times the same row.zul. Now I have an ID error because the row.zul file uses static id's.

In zk 8.0 it is possible to use the tag but I can't use that because we are here at a very old version (3.6.4). Do you know any possibilities to solve that problem? I need to give the elements ID's because I want to read from them


Solution

  • You don't need to autogenerate id's.
    They need to be in the correct idScope.

    An idscope is marked by the interface IdSpace.
    So you need to put the row in a separate idScope, so just wrap a component who implement the IdSpace like window, include or create your own component like extends Div implements IdScope.

    If you use CSS selectors, remember that you need to alter it a little bit.