Selectbox Template"
From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} Similar to Listbox, you can render a selectbox with a template. However, noti...") |
m ((via JWB)) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
Similar to [[ZK Developer's Reference/MVC/View/Template/Listbox Template|Listbox]], you can render a selectbox with a template. However, notice that, unlike other components, selectbox doesn't allow any child component, so you have to render each item as a string. For example, | Similar to [[ZK Developer's Reference/MVC/View/Template/Listbox Template|Listbox]], you can render a selectbox with a template. However, notice that, unlike other components, selectbox doesn't allow any child component, so you have to render each item as a string. For example, | ||
− | <source lang="xml" | + | <source lang="xml" highlight="2,3"> |
<selectbox model="${users}" onSelect='alert(model.get(event.getData()));'> | <selectbox model="${users}" onSelect='alert(model.get(event.getData()));'> | ||
<template name="model"> | <template name="model"> | ||
Line 11: | Line 11: | ||
</source> | </source> | ||
− | where we assume there is a list model (<javadoc>org.zkoss.zul.ListModel</javadoc>) called < | + | where we assume there is a list model (<javadoc>org.zkoss.zul.ListModel</javadoc>) called <code>users</code> such as: |
<source lang="java"> | <source lang="java"> | ||
Line 18: | Line 18: | ||
=Version History= | =Version History= | ||
− | + | ||
− | {| | + | {| class='wikitable' | width="100%" |
! Version !! Date !! Content | ! Version !! Date !! Content | ||
|- | |- |
Latest revision as of 07:34, 8 July 2022
Similar to Listbox, you can render a selectbox with a template. However, notice that, unlike other components, selectbox doesn't allow any child component, so you have to render each item as a string. For example,
<selectbox model="${users}" onSelect='alert(model.get(event.getData()));'>
<template name="model">
Name is ${each}
</template>
</selectbox>
where we assume there is a list model (ListModel) called users
such as:
ListModelList model = new ListModelList(new String[] { "Tony", "Ryan", "Jumper", "Wing", "Sam" });
Version History
Version | Date | Content |
---|---|---|
6.0.0 | November 2011 | The selectbox component was introduced. |
6.0.0 | July 2011 | The template feature was introduced. |