23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Online Media Library<br />

How to use the ${each} variable inside a zscript block<br />

The ${each} is an Expression Language variable, and therefore, it cannot<br />

be used directly inside a zscript block. But in some cases (especially<br />

in event handlers) it's very useful to use ${each}. It's possible to define<br />

a custom attribute, and place the variable in the custom-attributes map<br />

for the component. With the ${each} is stored with key thename in the mentioned<br />

map. In the zscript block, it's now possible to access this object with<br />

componentScope.get("thename").<br />

The data in the listbox component is shown with the help for the forEach attribute<br />

in combination with the ${each} EL (Expression Language) variable.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

The full implementation of the redesigned page is given below. Here, we want<br />

to mix elements from XHTML with elements from ZUL. For that we need a clear<br />

separation of the two worlds. In an XML file, there is an element that helps us to do<br />

this separation, the namespace. If we use a namespace we have to add a prefix to<br />

each tag from that namespace (e.g. ). For further information about<br />

namespaces visit http://www.w3.org/TR/REC-xml-names/.<br />

<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!