It is better to do this in *.page because there is automaticaly solved
problems with sharing objact state between clients.
But if you realy want to initialize in *.java dont use something like this:
private List users;
public List getUsers(){return users;}
public void setUsers(List users){this.users = users;}
pageBeginRender(...){
setUsers(....);
}
but use something like:
public List getUsers(){
List users = CODE TO GET DATA FROM DB;
return users;
}
regards,
Radim
Tomáš Drenčák wrote:
Thanks, I'll try it. But is there a way to initialize e.g. users
property in page class (.java) in similar way like in .jwc? <property
name="users" initial-value="manager.users"/> I'd like to have
everything in class and annotations.
2005/9/15, Radim Burget <[EMAIL PROTECTED]>:
Hi Tom,
your problem is probably in wrong initialization in method
pageBeginRender(...) which is called after sorting - so this is the
reason of your exception. I guess you are using something like this:
public void pageBeginRender(PageEvent event) {
setUsers(getUserManager().getUsers(null));
}
So try to initialize the values in *.page not in page beginRender(...)
*.java
abstract public List getUsers();
*.page
<property name="users">
getUserManager().getUsers(null) // (code for retrieve users)
</property>
And disable caching:
<component id="table" type="contrib:Table">
<binding name="source" value="users"/>
<binding name="volatile" value="true"/>
<binding name="columns" value="Full Name:fullName,Email:email,
Phone Number:phoneNumber, !action"/>
<binding name="rowsClass" value="beans.evenOdd.next"/>
<binding name="columnsClass" value="literal:title"/>
<binding name="pageSize" value="2"/>
<!--binding name="tableSessionStateManager" value="new
org.apache.tapestry.contrib.table.model.common.FullTableSessionStateManager()"/-->
</component>
Regards.
Radim Burget
Hi all!
I have a problem with contrib table and no idea to solve it :(. I'd
like to have Collection type property in my page class which would be
initialized in pageBeginRender and not persistent. This works fine for
first display, but after I click on sorting column exception is
thrown:
Either the tableModel parameter or both source and columns parameters
must be specified by component
produkt/SuciastkaList/zoznamTable.tableView.
How can I have non persistent property and sortable table? Solution
could be to lazy initialize this property but collection is read again
from database (same data, same order) and then sorted - but I'd like
to avoid this.
Please help
tomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]