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.select.annotation.Wire; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Grid; import org.zkoss.zul.ListModelList; import org.zkoss.zul.Row; import org.zkoss.zul.Window; public class TabController extends GenericForwardComposer { @Wire private Row r1; @Wire private Row r2; @Wire private Grid grid; private final ListModelList listModelList = new ListModelList<>(); @Override public void doAfterCompose(Window comp) throws Exception { super.doAfterCompose(comp); r1.addEventListener(Events.ON_CLICK, new EventListener() { public void onEvent(Event ev) throws Exception { final MyModel model = new MyModel(); model.setA1("11"); model.setA2("a2"); model.setA3("a3"); model.setA4("a4444444444444"); listModelList.clear(); listModelList.add(model); Clients.resize(grid); } }); r2.addEventListener(Events.ON_CLICK, new EventListener() { public void onEvent(Event ev) throws Exception { final MyModel model = new MyModel(); model.setA1("aaaaaaaaaaaaaa1"); model.setA2("aaaaaaaaaaaaaaaaaaa2"); model.setA3("a3"); model.setA4("a4"); listModelList.clear(); listModelList.add(model); Clients.resize(grid); } }); final MyModel model = new MyModel(); model.setA1("a1"); model.setA2("a2"); model.setA3("a3"); model.setA4("a4"); listModelList.add(model); grid.setModel(listModelList); } }