-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everyone, I am trying to execute a Clients.shownotification, which is executed in a component that is in another zul, but it seems that the component did not exist. Both zul are running at the same time and have the same viewModel. This is my code.
MAIN.ZUL <window> <borderlayout >="" <west=""> <include src="/WEB-INF/include/menuPanel.zul"/> </west>
<center>
<borderlayout id="borde" >
<center >
<caption >
<include src="/WEB-INF/include/toolbar.zul" />
</caption>
</center>
</borderlayout>
</center>
</borderlayout> </window>
MENUPANEL.ZUL
<listbox >="" <listhead="" sclass="menu-category" >="" <listheader="" label="CATEGORIA" id="cate"/> </listhead> </listbox>
TOOLBAR.ZUL
<label value="algo" onclick="Clients.showNotification("Seleccione categoría", Clients.NOTIFICATION_TYPE_WARNING, cate, "middle_center", 2000)"/>
Because <include>
create an ID space, toolbar.zul and menuPanel.zul belong to different ID spaces since they are both inside <include>
.
If you can replace them with
<apply templateURI="/path/mypage.zul"/>
Then no id space is created and showNotification() will work.
First, thanks for the response. I understand what you want to tell me, but I do not understand the solution. Would you suggest that you replace the <include> tag with the <apply> tag? If so, the error that occurs is that the <apply> component is not defined (Component definition not found: apply in [LanguageDefinition: xul/html])
Please include the zuti.jar which contains <apply>
in your project.
If you don't use ZK EE, you have to locate the target component correctly. ZK searches a component by ID in one id space only by default. Since <include>
create an ID space, you have to find the target component manually. like:
<window id="w1">
<button id="b" label="b"/>
</window>
<window id="w2">
<button id="b" label="b" onClick='Clients.showNotification("msg", w1.query("#b"))'/>
<button id="b2" label="b" onClick='Clients.showNotification("msg", w1.getFellow("b"))'/>
</window>
<window>
also creates an id space.
You should give id to <include>
first like:
<include id="toolbar" src="/WEB-INF/include/toolbar.zul" />
Then
toolbar.query("#c")
please refer to https://www.zkoss.org/wiki/ZKDeveloper%27sReference/UIComposing/IDSpace#FindComponentManually
Asked: 2017-11-11 01:38:00 +0800
Seen: 17 times
Last updated: Nov 20 '17
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status