Combobox Renderer"
From Documentation
(Created page with "{{ZKDevelopersReferencePageHeader}} When a combobox (<javadoc>org.zkoss.zul.Combobox</javadoc>) is assigned with a model, a default renderer is assigned too<ref>For the concept ...") |
m ((via JWB)) |
||
Line 21: | Line 21: | ||
=Version History= | =Version History= | ||
{{LastUpdated}} | {{LastUpdated}} | ||
− | {| | + | {| class='wikitable' | width="100%" |
! Version !! Date !! Content | ! Version !! Date !! Content | ||
|- | |- |
Revision as of 08:17, 11 January 2022
When a combobox (Combobox) is assigned with a model, a default renderer is assigned too[1]. The default renderer will assume that the combobox displays the data as a string[2]. If you want to display more sophisticated information or retrieve a particular field of the data, you have to implement ComboitemRenderer to handle the rendering.
For example,
public class MyRenderer implements ComboitemRenderer {
public void render(Comboitem item, Object data, int index) throws Exception {
item.setLabel(((User)data).getName());
item.setDescription(((User)data).getDescription());
}
}
- ↑ For the concept about component, model and renderer, please refer to the Model-driven Display section.
- ↑ If the tree is assigned a template called model, then the template will be used to render the tree. For more information, please refer to the Tree Template section.
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The index argument was introduced. |