You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Kevin C. Dorff" <kd...@kcp.com> on 2004/02/10 16:58:03 UTC

How to update a contrib:table as the result of a form posting?

I have a TableView (using Simple* classes) that lives within a component 
that I construct to display the results of a query based on a form 
posting. The first time the form is posted it displays the data 
correctly. Paging works correctly.

The problem is that when I perform another query it does not update the 
table, the same old data is displayed. If I go to another tapestry game 
and come back, the new data is displayed.

I found elsewhere a hint that seemed like it would work, which is after 
I re-create the table mode, data, etc. I should do something like

        oLastQueryTable.getTableModel().tableDataChanged(new 
CTableDataModelEvent());
        throw new PageRedirectException("Home");

("Home" is the page where the data is displayed) but that does not do it.

Can somebody give me a clue? I feel like this should be REALLY simple 
and I am just missing something.
Kevin



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


Re: How to update a contrib:table as the result of a form posting?

Posted by "Kevin C. Dorff" <kd...@kcp.com>.
It appears my problem was that the component that contained the table 
was INSIDE the page's <form> which was completely screwing up the order 
in which things were called by Tapestry. I moved the component that 
contained the table and everything worked fine.

Kevin

David Moran wrote:

>I believe that setting the tableSessionStateManager to
>NullTableSessionStateManager  so the data is not stored in the session
>and will be recreated each time will work, but I'm not sure if its' the
>best way. 
>
>On Tue, 2004-02-10 at 10:58, Kevin C. Dorff wrote:
>  
>
>>I have a TableView (using Simple* classes) that lives within a component 
>>that I construct to display the results of a query based on a form 
>>posting. The first time the form is posted it displays the data 
>>correctly. Paging works correctly.
>>
>>The problem is that when I perform another query it does not update the 
>>table, the same old data is displayed. If I go to another tapestry game 
>>and come back, the new data is displayed.
>>
>>I found elsewhere a hint that seemed like it would work, which is after 
>>I re-create the table mode, data, etc. I should do something like
>>
>>        oLastQueryTable.getTableModel().tableDataChanged(new 
>>CTableDataModelEvent());
>>        throw new PageRedirectException("Home");
>>
>>("Home" is the page where the data is displayed) but that does not do it.
>>
>>Can somebody give me a clue? I feel like this should be REALLY simple 
>>and I am just missing something.
>>Kevin
>>
>>
>>
>>---------------------------------------------------------------------
>>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: How to update a contrib:table as the result of a form posting?

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
I solved this problem by creating a custom model, and then manipulating
the data inside directly. If you are going this path I can give you part
of the code.

Len

On Tue, 2004-02-10 at 21:29, Kevin C. Dorff wrote:

> I have now tried using the NullTableSessionStateManager and at the end 
> of the page generation doing a reset on the TableView component. Neither 
> of these made any difference. The looks like the problem is related to 
> the fact that the component that contains the table is some how 
> generated BEFORE the form post listener is called, which makes little to 
> no sense... Why wouldn't the table generation events (from the .jwc 
> file) occur AFTER the submit listener? I have tried in my submit 
> listener to PageRedirectException back to the same page but that seems 
> to do nothing.
> 
> Does anyone have working code where the results of the table are changed 
> after a post and it updates the table appropriately?
> 
> Kevin
> 
> David Moran wrote:
> 
> >I believe that setting the tableSessionStateManager to
> >NullTableSessionStateManager  so the data is not stored in the session
> >and will be recreated each time will work, but I'm not sure if its' the
> >best way. 
> >
> >On Tue, 2004-02-10 at 10:58, Kevin C. Dorff wrote:
> >  
> >
> >>I have a TableView (using Simple* classes) that lives within a component 
> >>that I construct to display the results of a query based on a form 
> >>posting. The first time the form is posted it displays the data 
> >>correctly. Paging works correctly.
> >>
> >>The problem is that when I perform another query it does not update the 
> >>table, the same old data is displayed. If I go to another tapestry game 
> >>and come back, the new data is displayed.
> >>
> >>I found elsewhere a hint that seemed like it would work, which is after 
> >>I re-create the table mode, data, etc. I should do something like
> >>
> >>        oLastQueryTable.getTableModel().tableDataChanged(new 
> >>CTableDataModelEvent());
> >>        throw new PageRedirectException("Home");
> >>
> >>("Home" is the page where the data is displayed) but that does not do it.
> >>
> >>Can somebody give me a clue? I feel like this should be REALLY simple 
> >>and I am just missing something.
> >>Kevin
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>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: How to update a contrib:table as the result of a form posting?

Posted by Mindbridge <mi...@yahoo.com>.
Hi Kevin,

I cannot fully reproduce what you are saying, but may I suggest using the
updated Table (in beta4) and in particular the source and columns parameters
instead? With them using Table is pretty much like using Foreach and it is
guaranteed that what is dispayed will reflect precisely what is passed, even
if you make changes in a listener. My guess is that this would simplify your
code a lot and eliminate any complexity that might be the reason for your
issues. If this helps, here is a link to the updated docs:

http://jakarta.apache.org/tapestry/doc/ComponentReference/contrib.Table.html

There is an example further down the page, as well as in the LocaleList and
LocaleSelection components in the Workbench (they have been updated as
well). Finally, if you are using the Table in a form, consider using
FormTable instead -- it may help a lot (see docs in Component Reference and
example in the comments of LocaleList.html).

Sorry, I am not giving you a direct answer here, but I do think this will
simplify your code a lot.

Best regards,
-mb

----- Original Message ----- 
From: "Kevin C. Dorff" <kd...@kcp.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, February 10, 2004 9:29 PM
Subject: Re: How to update a contrib:table as the result of a form posting?


> I have now tried using the NullTableSessionStateManager and at the end
> of the page generation doing a reset on the TableView component. Neither
> of these made any difference. The looks like the problem is related to
> the fact that the component that contains the table is some how
> generated BEFORE the form post listener is called, which makes little to
> no sense... Why wouldn't the table generation events (from the .jwc
> file) occur AFTER the submit listener? I have tried in my submit
> listener to PageRedirectException back to the same page but that seems
> to do nothing.
>
> Does anyone have working code where the results of the table are changed
> after a post and it updates the table appropriately?
>
> Kevin
>
> David Moran wrote:
>
> >I believe that setting the tableSessionStateManager to
> >NullTableSessionStateManager  so the data is not stored in the session
> >and will be recreated each time will work, but I'm not sure if its' the
> >best way.
> >
> >On Tue, 2004-02-10 at 10:58, Kevin C. Dorff wrote:
> >
> >
> >>I have a TableView (using Simple* classes) that lives within a component
> >>that I construct to display the results of a query based on a form
> >>posting. The first time the form is posted it displays the data
> >>correctly. Paging works correctly.
> >>
> >>The problem is that when I perform another query it does not update the
> >>table, the same old data is displayed. If I go to another tapestry game
> >>and come back, the new data is displayed.
> >>
> >>I found elsewhere a hint that seemed like it would work, which is after
> >>I re-create the table mode, data, etc. I should do something like
> >>
> >>        oLastQueryTable.getTableModel().tableDataChanged(new
> >>CTableDataModelEvent());
> >>        throw new PageRedirectException("Home");
> >>
> >>("Home" is the page where the data is displayed) but that does not do
it.
> >>
> >>Can somebody give me a clue? I feel like this should be REALLY simple
> >>and I am just missing something.
> >>Kevin
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>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: How to update a contrib:table as the result of a form posting?

Posted by "Kevin C. Dorff" <kd...@kcp.com>.
I have now tried using the NullTableSessionStateManager and at the end 
of the page generation doing a reset on the TableView component. Neither 
of these made any difference. The looks like the problem is related to 
the fact that the component that contains the table is some how 
generated BEFORE the form post listener is called, which makes little to 
no sense... Why wouldn't the table generation events (from the .jwc 
file) occur AFTER the submit listener? I have tried in my submit 
listener to PageRedirectException back to the same page but that seems 
to do nothing.

Does anyone have working code where the results of the table are changed 
after a post and it updates the table appropriately?

Kevin

David Moran wrote:

>I believe that setting the tableSessionStateManager to
>NullTableSessionStateManager  so the data is not stored in the session
>and will be recreated each time will work, but I'm not sure if its' the
>best way. 
>
>On Tue, 2004-02-10 at 10:58, Kevin C. Dorff wrote:
>  
>
>>I have a TableView (using Simple* classes) that lives within a component 
>>that I construct to display the results of a query based on a form 
>>posting. The first time the form is posted it displays the data 
>>correctly. Paging works correctly.
>>
>>The problem is that when I perform another query it does not update the 
>>table, the same old data is displayed. If I go to another tapestry game 
>>and come back, the new data is displayed.
>>
>>I found elsewhere a hint that seemed like it would work, which is after 
>>I re-create the table mode, data, etc. I should do something like
>>
>>        oLastQueryTable.getTableModel().tableDataChanged(new 
>>CTableDataModelEvent());
>>        throw new PageRedirectException("Home");
>>
>>("Home" is the page where the data is displayed) but that does not do it.
>>
>>Can somebody give me a clue? I feel like this should be REALLY simple 
>>and I am just missing something.
>>Kevin
>>
>>
>>
>>---------------------------------------------------------------------
>>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: How to update a contrib:table as the result of a form posting?

Posted by David Moran <dm...@nc.rr.com>.
I believe that setting the tableSessionStateManager to
NullTableSessionStateManager  so the data is not stored in the session
and will be recreated each time will work, but I'm not sure if its' the
best way. 

On Tue, 2004-02-10 at 10:58, Kevin C. Dorff wrote:
> I have a TableView (using Simple* classes) that lives within a component 
> that I construct to display the results of a query based on a form 
> posting. The first time the form is posted it displays the data 
> correctly. Paging works correctly.
> 
> The problem is that when I perform another query it does not update the 
> table, the same old data is displayed. If I go to another tapestry game 
> and come back, the new data is displayed.
> 
> I found elsewhere a hint that seemed like it would work, which is after 
> I re-create the table mode, data, etc. I should do something like
> 
>         oLastQueryTable.getTableModel().tableDataChanged(new 
> CTableDataModelEvent());
>         throw new PageRedirectException("Home");
> 
> ("Home" is the page where the data is displayed) but that does not do it.
> 
> Can somebody give me a clue? I feel like this should be REALLY simple 
> and I am just missing something.
> Kevin
> 
> 
> 
> ---------------------------------------------------------------------
> 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: How to update a contrib:table as the result of a form posting?

Posted by Christopher Corde <cc...@yahoo.com>.
I think you need to call reset() on the table
component itself after the page is rendered. Then, the
next time you render the table it will be refreshed.

Chris

--- "Kevin C. Dorff" <kd...@kcp.com> wrote:
> I have a TableView (using Simple* classes) that
> lives within a component 
> that I construct to display the results of a query
> based on a form 
> posting. The first time the form is posted it
> displays the data 
> correctly. Paging works correctly.
> 
> The problem is that when I perform another query it
> does not update the 
> table, the same old data is displayed. If I go to
> another tapestry game 
> and come back, the new data is displayed.
> 
> I found elsewhere a hint that seemed like it would
> work, which is after 
> I re-create the table mode, data, etc. I should do
> something like
> 
>        
> oLastQueryTable.getTableModel().tableDataChanged(new
> 
> CTableDataModelEvent());
>         throw new PageRedirectException("Home");
> 
> ("Home" is the page where the data is displayed) but
> that does not do it.
> 
> Can somebody give me a clue? I feel like this should
> be REALLY simple 
> and I am just missing something.
> Kevin
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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