RowRenderer and Combobox

asked 2012-08-14 13:36:32 +0800

soulsacrifire gravatar image soulsacrifire
15 1

Hi guys,

I've created a new RowRenderer for my Grid component and I've added some labels and one combobox to my grid.

How to trigger onChange combobox event?

This is my zul page:
<grid id="grElencoCandidati" hflex="1" mold="paging" vflex="1">
<columns id="columnsCandidati" hflex="1" menupopup="hideColumn" sizable="true">
<column id="clCandidatoCognome" label="Cognome" width="48px" />
<column id="clCandidatoNome" label="Nome" hflex="8" />
<column id="clCandidatoCodiceFiscale" label="Codice Fiscale" hflex="8" />
<column id="clCandidatoNazione" label="Nazione" width="92px" />
<column id="clCandidatoComune" label="Comune" width="92px" />
<column id="clCandidatoDataNascita" label="DataNascita" width="56px" />
<column id="clCandidatoSesso" label="Sesso" width="56px" />
<column id="clCandidatoEmail" label="Email" width="56px" />
<column id="clCandidatoTelefono" label="Telefono" width="56px" />
<column id="clCandidatoValutato" label="Situazione" width="16" />
<rows hflex="1" />

This is my RowRenderer class:
package ecodata.labora.renderer;

import java.util.Arrays;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.text.SimpleDateFormat;

import org.zkoss.util.resource.LabelLocator;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Path;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.FulfillEvent;
import org.zkoss.zul.Button;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Column;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Label;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Row;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.Label;
import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.Vbox;
import org.zkoss.zul.api.Datebox;

import org.zkoss.zul.ListModelList;

import ecodata.labora.model.Candidato;
import ecodata.labora.model.Candidatura;
import ecodata.labora.model.CatalogFacade;
import ecodata.labora.model.CatalogFacadePortal;

public class RendererGridCandidatiRicerca implements RowRenderer {

public RendererGridCandidatiRicerca() {

public void render(final Row row, final java.lang.Object data) {
// TODO Auto-generated method stub
SimpleDateFormat sdf = new SimpleDateFormat((Sessions.getCurrent()).getAttribute("formatoData").toString());

CatalogFacade cf;
CatalogFacadePortal cfp;
if ((Sessions.getCurrent()).getAttribute("cfp") == null) {
cfp = new CatalogFacadePortal();
(Sessions.getCurrent()).setAttribute("cfp", cfp);
} else {
cfp = (CatalogFacadePortal) (Sessions.getCurrent()).getAttribute("cfp");

if ((Sessions.getCurrent()).getAttribute("cf") == null) {
cf = new CatalogFacade();
(Sessions.getCurrent()).setAttribute("cf", cf);
} else {
cf = (CatalogFacade) (Sessions.getCurrent()).getAttribute("cf");

Candidatura c = (Candidatura) data;
Candidato candidato = c.getCandidato();

row.setAttribute("data", c);

Label lblCognome = new Label((candidato.getCognome() == null) ? "" : candidato.getCognome());

Label lblNome = new Label((candidato.getNome() == null) ? "" : candidato.getNome());

Label lblCF = new Label((candidato.getCodiceFiscale() == null) ? "": candidato.getCodiceFiscale());

Label lblNazione = new Label ((candidato.getNascitaNazione() == null) ? "": candidato.getNascitaNazione().getNazione());

Label lblComune = new Label ((candidato.getNascitaComune() == null) ? "" : candidato.getNascitaComune().getComune());

Label lblDataNascita = new Label ((candidato.getDataNascita().toString() == null) ? "" : sdf.format(candidato.getDataNascita()));

Label lblSesso = new Label((candidato.getDcSesso() == null) ? "" : cf.getDecodificaValore("LA_OFFERTA", "DC_SESSO", candidato.getDcSesso())); //add some data to my combobox

Label lblEmail = new Label((candidato.getEmail() == null) ? "" : candidato.getEmail());

Label lblTelefono = new Label((candidato.getTelefono() == null) ? "" : candidato.getTelefono());

List<String> lp = (List<String>)cfp.getDecodificheValori("LA_CANDIDATURA","DC_VALUTATO", "CHIAVE"); //add some data to my combobox
Combobox cbValutato = new Combobox();
cbValutato.setModel(new ListModelList(lp));

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2012-08-20 06:36:13 +0800

soulsacrifire gravatar image soulsacrifire
15 1

Hi Vincent,

I did it!

Thank a lot for your suggestions.

link publish delete flag offensive edit

answered 2012-08-20 01:19:38 +0800

vincentjian gravatar image vincentjian
2245 6

Hi soulsacrifire,

You can try register onChange event by addEventListener API.

Combobox cbValutato = new Combobox();
cbValutato.setModel(new ListModelList(lp));
cbValutato.addEventListener("onChange", new EventListener() {
    // do something when combobox value changed

link publish delete flag offensive edit

answered 2012-08-16 07:29:52 +0800

soulsacrifire gravatar image soulsacrifire
15 1

Hi guys,

In my RowRenderer Class I used combobox.addEventListener("onInitRenderLater",new EventListener() {

public void onEvent(Event arg0) throws Exception {
// TODO Auto-generated method stub

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2012-08-14 13:36:32 +0800

Seen: 115 times

Last updated: Aug 20 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More