You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kurt Zoglmann <zo...@yahoo.com> on 2004/09/20 04:42:51 UTC

Newbie Persistent Problem

(I sincerely hope this doesn't contain any HTML. I'm
not at work to double check this and I just have
webmail at the moment.)

I have an administrative page that has several tables,
one table for each user. Each table is a listing of
events for that user. Each table of events has a
paginator that allows the user to page through the
listings of that table. I would like the other
paginate components to not change their table
positions when a user clicks on a paginate link. If
the user hits the administrative page without clicking
on one of the paginate links, I want the whole page to
refresh from scratch. (I think I have this last part
figured out, so I have left it out of the example to
simply my questions.)

I would like to use a generic paginator component that
can also be used else where.

The two problems are: 
1. The Paginate component does not return values to
the UserEvents component until it is reached in its
html. Is there a way to force it to render and buffer
the output until it is needed? 

2. The paginate component persistence for currentPage
and totalPages does not seem to work when there are
many paginate components within the page. Is there a
way to make this work without somehow trying to
persist this myself in the session?


Administrative.page:
�
<component id=�userEvents� type=�UserEvents�>
  <binding name=�user� expression=�user�/>
</component>

<property-specification name=�users�
type=�MyPackage.User[]�/>
<property-specification name=�user�
type=�MyPackage.User�/>
�

Administrative.html:
..
<span jwcid=�@Foreach� source=�ognl:users�
value=�ognl:user� element=�tr�>
  <span jwcid=�userEvents�>user events</span>
</span>

UserEvents.jwc
..
<parameter name=�user� type=�MyPackage.User�
required=�yes�/>

<component id=�paginate� type=�Paginate�>
  <binding name=�numRows� expression=�numRows�/>
<!�UserEvents.numRows returns getAllEvents().length
&#61664;
  <binding name=�beginIndex� expression=�beginIndex�/>
  <binding name=�endIndex� expression=�endIndex�/>
</component>

<property-specification name=�allEvents�
type=�MyPackage.Events[]�/>
(This property specification is populated from
database in UserEvents.prepareForRender(IRequestCycle)
 and based on incoming parameter �user�.)

<property-specification name=�displayEvents�
type=�MyPackage.Events[]�/>
(This property is populated in
UserEvents.prepareForRender(IRenderCycle) and based on
results from the paginate component�beginIndex and
endIndex.)

<property-specification name=�event�
type=�MyPackage.Event�/>

<property-specification name=�beginIndex� type=�int�/>
<property-specification name=�endIndex� type=�int�/>
�

UserEvents.html
�
<span jwcid=�paginate�>There is a problem if this is
put below the �for each� loop. Components seem to be
rendered in the order they are encountered in the html
file. Is there a way to force this so that it isn�t a
problem?</span>

<span jwcid=�@Foreach� source=�ognl:displayEvents�
value=�ognl:event� element=�tr�>
  <span jwcid=�@Insert� value=�ognl:event.name�>
�
</span>
�

Paginate.jwc
�
<parameter name=�numRows� required=�yes�
direction=�in�/>
<parameter name=�beginIndex� required=�yes�
direction=�auto�/> <!�problem here &#61664;
<parameter name=�endIndex� required=�yes�
direction=�auto�/> <!�problem here &#61664;

<property-specfication name=�currentPage� type=�int�
persistent=�yes� initial-value=�0�/>
<property-specification name=�totalPages� type=�int�
persistent=�yes� initial-value=�0�/>
�

Paginate.html
<a jwcid="@DirectLink"
listener="ognl:listeners.firstPageAction"
    parameters="ognl:params">&lt;&lt;</a>

<a jwcid="@DirectLink"
listener="ognl:listeners.previousPageAction"
    parameters="ognl:params">&lt;</a>

<span jwcid="@Insert"
value="ognl:currentPage">1</span> of
<span jwcid="@Insert"
value="ognl:totalPages">10</span>

<a jwcid="@DirectLink"
listener="ognl:listeners.nextPageAction"
    parameters="ognl:params">&gt;</a>

<a jwcid="@DirectLink"
listener="ognl:listeners.lastPageAction"
    parameters="ognl:params">&gt;&gt;</a>


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