0

Update parent window from child

asked 2011-05-09 10:18:36 +0800

LuisVelez gravatar image LuisVelez
12

Hi,

My form.zul has a listbox that load data from db using AnnotateDataBinder and works perfectly.

This form has also a new button that opens a new zul (execution.createComponents("/desempeno.zul", win, map);)
In desempeno.zul i add a new record to my db and when the record is saved i call the onClose() event.

how can i update the listbox in the form.zul when i call the onClose() event in the desempeno.zul window?

Thanks

Luis Alberto Vélez

delete flag offensive retag edit

7 Replies

Sort by » oldest newest

answered 2011-05-10 01:53:42 +0800

mikelara gravatar image mikelara
144
www.mextisa.com.mx

updated 2011-05-10 02:03:27 +0800

Hi Luis.

You could refresh the model programatically, here just a way to do it...

in your form.zul for example...

...
<listbox id="listaexperiencias" model="@{experiencias, load-after='btnrefresh.onClick'}" rows="5" width="268px" height="99px">
   <listhead sizable="true">
      <listheader label="Puesto" />
      <listheader label="Empresa"/>
   </listhead>
   <listitem self="@{each=experiencia}" value="@{experiencia}">
      <listcell label="experienciaselected" value="@{experiencia.experienciaPK.idexperiencia}" visible="false"/>
      <listcell label="@{experiencia.puesto}"/>
      <listcell label="@{experiencia.empresa}"/>
   </listitem>
</listbox>
...
<!-- btnrefresh just to catch  a refresh event (onClick really) form modal child window -->
<button id="btnrefresh" label="refrescar" visible="false"/>
...

note the load-after='btnrefresh.onClick' when declaring the model for the listbox.
Then at your new.zul composer (in your case at the onClose action)...
...
public void onClick$btnterminar(){  //or in your case the onClose() action
   //at parent window reload listaexperiencias box sending onclick event to the btnrefresh button, then detach the child window...
   Events.sendEvent(new Event("onClick", (Button)((Window)ligarWin.getParent()).getFellow("btnrefresh") ));
   ligarWin.detach();
}
...

that should do the trick.

Mike Lara

link publish delete flag offensive edit

answered 2011-05-10 12:02:12 +0800

LuisVelez gravatar image LuisVelez
12

Mike, gracias por tu ayuda.

Veo que eres hispano, si es posible me gustaria contar con tu apoyo en alguno temillas de ZK, claro si es posible.

Por cierto, sería bueno iniciar un foro en español, que te parece?

Nuevamente, gracias.

Luis Velez

link publish delete flag offensive edit

answered 2011-05-10 14:29:37 +0800

mikelara gravatar image mikelara
144
www.mextisa.com.mx

De nada Luis,

Saludos y pues solo estaba tratando en algún rato libre de regresar un poco de la ayuda que también he recibido en el foro.
Si. Sería bueno iniciar un foro en español, si te interesa también hay un grupo en linkedin en esta liga donde puedes compartir comentarios respecto al framework. Suerte y estamos en contacto.

Mike Lara

link publish delete flag offensive edit

answered 2016-08-25 13:55:09 +0800

Ihung gravatar image Ihung
1

Boa Tarde,

Apos fazer o que disse obtenho esse erro: SEVERE: >>org.zkoss.zk.ui.ComponentNotFoundException: Fellow component not found: btnRefresh

O que será que esta a faltar.

Abraço

link publish delete flag offensive edit

answered 2016-08-25 13:55:41 +0800

Ihung gravatar image Ihung
1

Boa Tarde,

Apos fazer o que disse obtenho esse erro: SEVERE: >>org.zkoss.zk.ui.ComponentNotFoundException: Fellow component not found: btnRefresh

O que será que esta a faltar.

Abraço

link publish delete flag offensive edit

answered 2016-08-25 15:03:22 +0800

luiggi gravatar image luiggi
1

Hola, soy luiggi hispano, si existe un foro en español, les agradecería mucho que me indiquen.

En el tema anterior intentaba decir que tengo una pantalla.zul para subir una imagen y el código antes mencionado funciona correctamente si lo pruebo en mi maquina local, pero al publicarlo al mundo en un servidor tomcat con debian server, al subir la imagen me retorna un error como si no localizara la imagen.

mensaje al subir la foto: Not an image asdf.jpg

link publish delete flag offensive edit

answered 2016-08-26 07:23:36 +0800

IngoB gravatar image IngoB flag of Germany
256 6

updated 2016-08-26 07:25:36 +0800

Hallo, wie geht es euch? Ich könnte auch auf Deutsch antworten, mach ich aber nicht :)

As long as there is no spanish forum it would be nice to keep it english, since otherwise only a limited group of persons can help you :)

You could add an Refresh - Eventlistener to form.zul

myWindow.addEventListener("onRefresh", new EventListener<Event>() {
            @Override
            public void onEvent(Event event) throws Exception {
                refresh();
            }
        });

and on desempeno.zul

        Events.postEvent("onRefresh", this.self, null);
        this.self.detach();
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

Follow

RSS

Stats

Asked: 2011-05-09 10:18:36 +0800

Seen: 615 times

Last updated: Aug 26 '16

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