-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi
I have a small zul page for displaying dynamic data (only 45 listitems)... and I want to fire an event when a row is selected.
Everything is fine with the first 10 rows... then... Nothing..
I couldn't understand the event is fired for the first 10 items!.. What's wrong?
My zul page looks like the following:
<listbox id="selectedRows" rows="10" fixedLayout="true">
<listhead>
<listheader width="5%" label="id" sort="auto"/>
<listheader label="class" sort="auto"/>
</listhead>
<zscript>
List standardClasses = facade.getStandardClasses();
</zscript>
<listitem value="Standards" forEach="${ standardClasses }" onDoubleClick="searchWindow.addSelected()" >
<listcell style="padding-bottom: 60px" label="${each.nr} " />
<listcell style="overflow: hidden; padding: 10px" label="${each.txt}" />
</listitem>
</listbox>
Any idea would be welcome! Please urgent help needed!
-nat
Hi nat,
what is your searchWindow in
onDoubleClick="searchWindow.addSelected()"
Hi nat-
I tried this in the ZK DEMO:
<window title="My First Window" border="normal" width="200px"> <listbox id="selectedRows" rows="10" fixedLayout="true"> <listhead> <listheader width="30%" label="id" sort="auto"/> <listheader label="class" sort="auto"/> </listhead> <zscript> void msg() { alert("hello"); } <![CDATA[ List standardClasses = new ArrayList(); for (int i = 0; i < 100; i++) standardClasses.add("ITEM " + i); ]]> </zscript> <listitem value="Standards" forEach="${ standardClasses }" onDoubleClick="msg()" > <listcell style="padding-bottom: 200px" label="1 " /> <listcell style="overflow: hidden; padding: 10px" label="${each}" /> </listitem> </listbox> </window>
And it works, even for the latest elements...
Because I look in the source code, and found:
/** Returns the rows. Zero means no limitation. * <p>Default: 0. */ public int getRows() { return _rows; }
and
public String getOuterAttrs() { final StringBuffer sb = new StringBuffer(80).append(super.getOuterAttrs()); if (inSelectMold()) { HTMLs.appendAttribute(sb, "name", _name); HTMLs.appendAttribute(sb, "size", getRows());
So, I guess it will set a limitation to the size of of listbox.
After all, it's a little debug trick to search special number or character.
Two "10" in the question? Is it only a coincidence? Or it's the clue?
which version of zk do you have?
I tested ziccardi code in ZK demo, it works in my firefox and IE.
Could you try to test ziccardi's code in you project too .
Hi Dennis
I use ZK 3.5.1.
I tested ziccardi code and it worked out very well!
My listbox contains only 45 items. Event fired very well on the first 10 items,... but from the 11th to the 45th item... no way to fire events.
What I can't understand is after removing "rows="10", my problem was solved! Bizarre...
-nat
Hi Dennis.
Could it be related to the fact that the rows after the 10th one are not rendered?
However, I don't understand why my code works and Nat's don't...
If this is the reason, I guess that if Nat puts rows="15" than it would work for the first 15 rows...
To Nat: do it works the same way if you use a composer, a renderer and a model (usually I work this way and have no problems)?
Hi Ziccardi
>if you use a composer, a renderer and a model (usually I work this way and have no problems)?
I know composer, renderer and model... but could you elaborate more how you use this trilogy?
Maybe I should follow such methodology for developing zk apps.
A sample code will be very useful.
Thanks a lot!
-nat
Asked: 2008-11-05 10:23:53 +0800
Seen: 241 times
Last updated: Nov 07 '08