Thanks for the reply.
I tried to create component in Composer with "this.getSelf()" but still encounter NullPointerException
Executions.createComponents("/mvvm.zul", this.getSelf(), null);
anthonylau ( 2013-08-06 07:22:33 +0800 )editFirst time here? Check out the FAQ!
I have a zul:
<window title="Templates" border="normal" zclass="z-window-overlapped"
apply="org.zkoss.bind.BindComposer" sizable="true"
viewModel="@id('vm') @init('com.foo.TemplateViewModel')"
onSize="System.out.println(self.getHeight())">
<listbox id="templateListbox" model="@load(vm.templates)"
onSelect="@command('onSelect')" vflex="1"
selectedItem="@bind(vm.selectedEvent)" >
<listhead sizable="true">
<listheader label="Name" sort="auto" />
<listheader label="Description" sort="auto" />
</listhead>
<template name="model" var="tpl">
<listitem>
<listcell label="@load(tpl.key)" />
<listcell label="@load(tpl.description)" />
</listitem>
</template>
</listbox>
</window>
I create component:
Component comp = Executions.createComponents("/mvvm.zul", null, null); comp.setParent(parent);
I will get NullPointerException:
Encounters an error: Unknown exception: java.lang.NullPointerException.
java.lang.NullPointerException
at org.zkoss.bind.impl.AbstractRenderer.resoloveTemplate(AbstractRenderer.java:59)
at org.zkoss.bind.impl.BindListitemRenderer.render(BindListitemRenderer.java:41)
at org.zkoss.zul.Listbox$Renderer.render(Listbox.java:2644)
at org.zkoss.zul.Listbox.renderItems(Listbox.java:2762)
at org.zkoss.zul.Listbox.service(Listbox.java:3490)
at org.zkoss.zk.ui.impl.DesktopImpl.service(DesktopImpl.java:701)
There is no exception if I access the zul through URL.
Yes right... if you directly access the zul it should work no any doubt.But when you trying to create zul with this below code
Executions.getCurrent().createComponents("/modalWindow.zul",
view, null);
You can not pass null in place of Component class object so you have to use like this
@Command
public void openModal(@ContextParam(ContextType.VIEW) Component view){
Executions.getCurrent().createComponents("/modalWindow.zul",
view, null);
}
Thanks for the reply.
I tried to create component in Composer with "this.getSelf()" but still encounter NullPointerException
Executions.createComponents("/mvvm.zul", this.getSelf(), null);
anthonylau ( 2013-08-06 07:22:33 +0800 )editAsked: 2013-08-06 03:28:37 +0800
Seen: 72 times
Last updated: Aug 06 '13
Databinding and auto-complete on combobox
Composite component and bind in ZK 6
How to detach / reattach MVVM windows?
Is there a way to resolve view model properties as input to client side javascripts?
How can I synchronize data in a ListBox in MVVM ? [closed]
MVVM Validator: class not found ? [closed]
How to Call Child ViewModel Method from Parent Window? [closed]