You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tomáš Drenčák <to...@gmail.com> on 2005/09/14 12:35:34 UTC

contrib Table sorting

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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib Table sorting

Posted by Radim Burget <Ra...@seznam.cz>.
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 <Ra...@seznam.cz>:
>  
>
>>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: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib Table sorting

Posted by Tomáš Drenčák <to...@gmail.com>.
I'm using FullTableSessionStateManager, but when I choose to sort the
table or move to another page (within table), then whole table stores
in session... Even if I choose another page and return back. So
changes in database couldn't be reflected. How can I erase those data
in session, so there would be a fresh data?

2005/9/16, Tomáš Drenčák <to...@gmail.com>:
> 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 <Ra...@seznam.cz>:
> > 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: tapestry-user-unsubscribe@jakarta.apache.org
> > >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>

Re: contrib Table sorting

Posted by Tomáš Drenčák <to...@gmail.com>.
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 <Ra...@seznam.cz>:
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib Table sorting

Posted by Radim Burget <Ra...@seznam.cz>.
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: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org