-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4577714
By: matteo_barbieri
Hi,
I'm writing a component from Java code.
This component has a Grid and I do:
binder.addBinding(grid, "model", "collection");
and then
binder.bindBean("collection", collection); binder.loadAll();
and the grid creates the right number of rows, but I have problems rendering rows correctly.
In zul I do:
<row self="@{each=obj}">
<label value="@{obj.name}"/>
<label value="@{obj.property}"/>
</row>
In Java I tried:
binder.addBinding(row, "self", "each=obj"); for(String p : properties) {
Label l = new Label();
binder.addBinding(l, "value", "obj."+p);
l.setParent(row);
}
and many other ways, but the result it's the same: every row has one label with the toString method of "each" object printed, like:
com.MyClass@957e72
com.MyClass@ae9862
com.MyClass@696079
Any idea?
Many thanks,
bye
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4581118
By: jebberwocky
Dear Matteo
I try the first sample u mentioned with code:
<window id="mainwin">
<zscript>
import org.zkoss.demo.Person;
int count = 30;
List persons = new ArrayList();
for(int j= 0; j < count; ++j) {
Person personx = new Person(j);
persons.add(personx);
}
</zscript>
<grid id="grid">
<rows>
<row self="@{each=obj}">
<label value="@{obj.name}"/>
<label value="@{obj.email}"/>
</row>
</rows>
</grid>
<zscript>
AnnotateDataBinder binder = new AnnotateDataBinder(mainwin);
binder.addBinding(grid, "model", "persons");
binder.bindBean("person", persons);
binder.loadAll();
</zscript>
</window>
It works fine in my case tho.
But I can duplicate your problem
by remove the row tag .
could u provide more information? thanks.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4581390
By: matteo_barbieri
Simply try to create the grid completely from java code, not using zul tags.
Grid grid = new Grid();
grid.setParent(mainwin);
Rows rows = new Rows();
rows.setParent(grid);
....
etc.
@pacuz plz post your problem in new thread
better with details and duplicatable cases
:)
Asked: 2007-10-19 10:48:22 +0800
Seen: 429 times
Last updated: Jul 10 '11