Organigram Renderer
From Documentation
Revision as of 04:01, 10 August 2018 by Charlesqiu (talk | contribs)
- Available for ZK:
[Since 8.6.0]
When an organigram (Organigram) is assigned with a model, a default renderer is assigned too[1]. The default renderer will assume that each Orgitem has one Orgnode, and it converts the data into a string directly[2]. If you want to change render style or retrieve a particular field of the data, you have to implement OrgitemRenderer to handle the rendering.
For example,
public class MyRenderer implements OrgitemRenderer {
public void render(Orgitem orgitem, Object data, int index) throws Exception {
final Button button = new Button(Objects.toString(data));
button.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) {
Clients.showNotification(button.getLabel());
}
});
Orgnode orgnode = new Orgnode();
button.setParent(orgnode);
orgnode.setParent(orgitem);
}
}
- ↑ For the concept about component, model and renderer, please refer to the Model-driven Display section.
- ↑ If the Organigram is assigned a template called model, then the template will be used to render the Organigram. For more information, please refer to the Organigram Template section.
Version History
Version | Date | Content |
---|---|---|
6.0.0 | February 2012 | The index argument was introduced. |