-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everyone, so, I have artigos.zul that consists on a listbox with some products from database, when I select a row my controller opens a new zul that receives as arguments the detail of the selected row.. The question is, when I use executions.createComponents, to create the detail zul, this new zul is created under artigos.zul.. How can I make it to create the detail zul over the current one(artigos.zul) .. What I did was crate a div that contains artigos.zul, when I make a selection, this div is set to false in .setVisible method.. Is there a better way?
artigos.zul
<zk>
<borderlayout>
<north vflex="min">
<div vflex="1" hflex="1" sclass="topo">
<hbox vflex="1" hflex="1" align="center">
<hbox hflex="1" vflex="1">
<button image="/imagens/return.png" width="50px" height="50px" href="index.zul" />
</hbox>
<hbox hflex="1" vflex="1" align="end" pack="end">
<button image="/imagens/home.png" width="50px" height="50px" href="index.zul" />
</hbox>
</hbox>
</div>
</north>
<center vflex="min">
<div hflex="1" vflex="1">
<listbox sizedByContent="true" span="true" id="artigosListbox" apply="artigos.LoadArtigos, artigos.ControllerArtigos" >
<listhead>
<listheader label="Código" />
<listheader label="Descrição" />
</listhead>
<template name="model">
<listitem>
<listcell label="${each.codigo }" />
<listcell label="${each.descricao }" />
</listitem>
</template>
</listbox>
</div>
</center>
<south vflex="min">
<include src="sul.zul" />
</south>
</borderlayout>
</div>
</zk> >
Controller
public class ControllerArtigos extends SelectorComposer<component> {
@Wire
private Listbox artigosListbox;
@Wire
private Div global;
@Listen("onSelect = #artigosListbox")
public void showDetail()
{
Set<Artigo> seleccao = ((Selectable<Artigo>) artigosListbox.getModel()).getSelection();
if(seleccao != null && !seleccao.isEmpty())
{
Map data = new HashMap();
Artigo info = seleccao.iterator().next();
data.put("CODIGO", info.getCodigo().toString());
data.put("DESCRICAO", info.getDescricao());
data.put("SRCIMAGEM", info.getCaminho());
data.put("PRECOIVA", info.getPrecoIva().toString());
global.setVisible(false);
Executions.createComponents("artigoDetail.zul", null, data);
}
}
}
As you did not shared artigoDetail.zul file code i can imagine you used Window Component there then i will suggest you to use ..
<window apply="org.zkoss.bind.BindComposer"
title="Column Manager"
viewModel="@id('vm') @init('com.MyViewModel')"
height="50%" width="48%" mode="modal" position="center" popup="true"
border="normal">
Use mode="modal"
in Window Component for more information how to create a modal Window you can check this ZK Modal Window
Asked: 2013-06-04 20:23:20 +0800
Seen: 13 times
Last updated: Jun 05 '13
Do not update to ZK Studio 2.0
Catch Server 503 Error - Or Catch Stale Page
how to save spreadsheet data into postgres database?
One controller file with multiple zul file
Why am I getting authentication error for ZK studio activation?
How can i make Tomcat (with virtual hosts) to parse the zul page in subfolders?