0

North hides when i refresh databind

asked 2012-04-16 13:35:41 +0800

mgvv gravatar image mgvv
127 2

Hi,

I'm using Borderlayout with North (filter textbox) and Center (listbox).
I use Zk 6.0 databind to fill listbox.
When i open zul on the first time North appear OK.
When i refresh databind North disappear.

Please help.

Thanks in advance,

Miguel Goncalves

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-04-17 08:26:01 +0800

mgvv gravatar image mgvv
127 2

Push

link publish delete flag offensive edit

answered 2012-04-18 07:14:24 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Pleae show us the codes. Does your north component have a fixed heigth ?

best
Stephan

link publish delete flag offensive edit

answered 2012-04-19 21:52:17 +0800

mgvv gravatar image mgvv
127 2

Hi Stephan,

I created a sample code to show bug.
Please select Show Items. On the first time North shows correct. Second time North hides.

ZKFiddle-Link

Item.java
package j1ekeig4$v2;

public class Item {
private Integer id;
private String descricao;

public Item(Integer id, String descricao) {
super();
this.id = id;
this.descricao = descricao;
}

public Item() {
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getDescricao() {
return descricao;
}

public void setDescricao(String descricao) {
this.descricao = descricao;
}

}


TestComposer.java
package j1ekeig4$v2;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.zkoss.bind.AnnotateBinder;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Tab;

public class TestComposer extends GenericForwardComposer<Component> {

/**
*
*/
private static final long serialVersionUID = 7548168648624725680L;

private List<Item> items=new ArrayList<Item>();
private Item selectedItem;

private Tab tabItems;

public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);

AnnotateBinder binder=new AnnotateBinder();

getItems().add(new Item(1, "Miguel"));
getItems().add(new Item(2, "Nelson"));

comp.setAttribute("vm", this);

binder.init(comp, this);

binder.loadComponent(comp, true);
}

@NotifyChange("items")
@Command
public void showItems() {
tabItems.setSelected(true);

getItems().add(new Item(getItems().size()+1, UUID.randomUUID().toString()));
}

public List<Item> getItems() {
return items;
}

public void setItems(List<Item> items) {
this.items = items;
}

public Item getSelectedItem() {
return selectedItem;
}

public void setSelectedItem(Item selectedItem) {
this.selectedItem = selectedItem;
}
}


index.zul
<zk>
<window title="Hello World!!" border="normal" width="800px"
height="500px" apply="j1ekeig4$v2.TestComposer">
<tabbox hflex="1" vflex="1">
<tabs>
<tab label="tab 1" />
<tab label="Items" id="tabItems" />
</tabs>
<tabpanels>
<tabpanel>
<button label="Show Items"
onClick="@command('showItems')" />
</tabpanel>
<tabpanel>
<borderlayout width="100%" height="100%">
<north size="30px" flex="true" splittable="true" minsize="30" maxsize="30" >
<combobox />
</north>
<center autoscroll="true">
<listbox model="@load(vm.items)">
<listhead>
<listheader label="id" />
<listheader label="descricao" />
</listhead>
<template name="model" var="item">
<listitem value="@load(item)">
<listcell
label="@load(item.id)" />
<listcell
label="@load(item.descricao)" />
</listitem>
</template>
</listbox>
</center>
</borderlayout>
</tabpanel>
</tabpanels>
</tabbox>
</window>
</zk>

Thanks,

Miguel Goncalves

link publish delete flag offensive edit

answered 2012-04-20 07:24:44 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2012-04-20 07:25:07 +0800

Hmmm, i think it's a bug in the timing of the rendering. Please write a bug report.

As a workaround you can call invalidate() on the borderlayout after you have declare the id for it in the zul.

	@NotifyChange("items")
	@Command
	public void showItems() {
		tabItems.setSelected(true);
          
          borderlayout.invalidate();
          
		getItems().add(new Item(getItems().size()+1, UUID.randomUUID().toString()));
	}

best
Stephan

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: 2012-04-16 13:35:41 +0800

Seen: 259 times

Last updated: Apr 20 '12

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