From Documentation

Jump to: navigation, search








The implementation of a custom renderer for a Selectbox (ItemRenderer) is straightforward[1]:

public class FooItemRenderer implements org.zkoss.zul.ItemRenderer {
    public String render(Component owner, Object data, int index) throws Exception {
        return data.toString(); //converting data to a string; it depends on your application's requirement
    }
}

Then, if we have a list model (ListModel) called users, and an instance of a custom renderer called userRenderer, then we can put them together in a ZUML document as follows:

<selectbox model="${users}" itemRenderer="${userRenderer}"/>

  1. For the concept about component, model and renderer, please refer to the Model-driven Display section.

Version History

Last Update : 2012/2/8


Version Date Content
6.0.0 November 2011 Selectbox was introduced.



Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.



You got stuck here?
Let us know how we can improve this page
For specific questions please use the forum