0

Problem with not Unique IDs on multiple same pages created with createcomponent

asked 2010-07-15 05:30:16 +0800

imbaspam gravatar image imbaspam
72

I need to create grid with detailed information about given item (like master grid in zk demo). Detailed information is available when I click 'plus sign' in the row of grid. I created initial row using java code (not zul since I need to dynamically update that grid) and have problems about detailed information (using detail tag found in grid palette). Data in detailed information should be pulled from external server when user request to see that detail (when clicking on plus sign), and detailed information is created using createcomponent function and passing needed arguments in hashmap. However I cannot update values of in created component when user expands it. I am catching that event, but I can't fill data then. I used EL expressions, but they can only fill data on beginning of component creation. If I use ID for labels it throws some kind of exception that IDs are already defined. Those IDs are perfectly unique but I create that component multiple times on page so I guess that they all have same IDs. I tried using Include tag and it works but I don't know how to pass arguments to included zul in this case.

Help will be appreciated.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2010-07-15 05:44:57 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi imbaspam,
without looking at the code it is quite difficult to give any specific suggestion in this case. Please post some code.

link publish delete flag offensive edit

answered 2010-07-15 06:03:06 +0800

imbaspam gravatar image imbaspam
72

Hi, ashishd

Here is the simple example that I am trying to get functional:

Test.zul (much like sample on this site)

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<window>
<zscript><![CDATA[
         import org.zkoss.zk.ui.Executions;
         import java.util.*;
         import org.zkoss.zul.*;
        String[][] iterateOverMe = {
                {"99", "Fred Flintstone"}
                ,{"8", "Wilma Flintstone"}
                ,{"65", "Barney Rubble"}
                ,{"32", "Betty Rubble"}
        };
        
        int row = 1;
        public void onCreate()
        {
 		    Map map = new HashMap();
 		    String temp = String.valueOf(row++);
 		    map.put("pageId", temp);
 		   	Executions.createComponents("/Test/render-item.zul", self, map);
        }
]]></zscript>
<tabbox mold="accordion">
<tabs>
 <tab forEach="${iterateOverMe}" label="${each[1]}"/>
</tabs>
<tabpanels>
 <tabpanel forEach="${iterateOverMe}" onCreate="onCreate();">
  </tabpanel>
</tabpanels>
</tabbox>
</window>

render-item.zul (component that I am trying to invoke)

<?page id="${arg.pageId}"?>
<zk>
	<zscript><![CDATA[ 
 	public void onClick()
 	{
 		lbl23.setValue("Something new");
 	}
 	]]></zscript>
	<vbox>
		<label value="${arg.pageId}" id="lbl23"/>
 		<button label="testing${arg.pageId}" onClick="onClick();"/>
	</vbox>
</zk>

Problem is with id in label control
Thanks for replying!

link publish delete flag offensive edit

answered 2010-07-15 07:05:01 +0800

vinhvo gravatar image vinhvo
369 3

<?page id="${arg.pageId}"?>
<zk>
<window border="none">
	<zscript><![CDATA[ 
 	public void onClick()
 	{
 		lbl23.setValue("Something new");
 	}
 	]]></zscript>
	<vbox>
		<label value="${arg.pageId}" id="lbl23"/>
 		<button label="testing${arg.pageId}" onClick="onClick();"/>
	</vbox>
	</window>
</zk>

In render-item.zul put them in <window></window> so that they are in different id space.
Br,VinhVo

link publish delete flag offensive edit

answered 2010-07-15 07:21:27 +0800

imbaspam gravatar image imbaspam
72

Thank you!!
This was just what I needed for. Never knew that window tag separate ID space.
Thanks again. :)

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: 2010-07-15 05:30:16 +0800

Seen: 259 times

Last updated: Jul 15 '10

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