Changing Grid.currentPage persistency to flash

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing Grid.currentPage persistency to flash

Davide Vecchi
Hi everybody

I see that the instance field that holds the current page number of a grid (org.apache.tapestry5.corelib.components.Grid.currentPage) is annotated with @Persist .

This has the probably desirable effect that f.ex. if I am on webpage A and it has a grid and I browse to its page #2 and then I go to another webpage and then I go back to webpage A its grid is still on its page #2 where I had left it.

However in my case this is not desirable and I would prefer that the grid page number is not remembered across different webpages.

Removing the @Persist annotation of Grid.currentPage instance field altogether would cause the impossibility to browse grid pages at all because the grid pager does a page reload and this loses the currentPage value, but persisting that value just until the next request - to preserve that value during the page reload  - seems to work fine: I changed the annotation from

@Persist

to

@Persist(PersistenceConstants.FLASH)

and I'm testing my pages to make sure this works. However I am also wondering if in theory changing that persistency to flash might be a bad idea for reasons that I don't know and that my tests so far are not showing. Does anyone have any opinion about this ?
Reply | Threaded
Open this post in threaded view
|

Re: Changing Grid.currentPage persistency to flash

Chris Poulsen
I haven't used the grid with flash persistence, so I cannot comment on that.

But I just want to let you know that you can control the behavior of
@Persist inside the Grid using "Persistence Strategy Inheritance" (
http://tapestry.apache.org/persistent-page-data.html ) without having to
alter the component itself.

--
Chris

On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <[hidden email]> wrote:

> Hi everybody
>
> I see that the instance field that holds the current page number of a grid
> (org.apache.tapestry5.corelib.components.Grid.currentPage) is annotated
> with @Persist .
>
> This has the probably desirable effect that f.ex. if I am on webpage A and
> it has a grid and I browse to its page #2 and then I go to another webpage
> and then I go back to webpage A its grid is still on its page #2 where I
> had left it.
>
> However in my case this is not desirable and I would prefer that the grid
> page number is not remembered across different webpages.
>
> Removing the @Persist annotation of Grid.currentPage instance field
> altogether would cause the impossibility to browse grid pages at all
> because the grid pager does a page reload and this loses the currentPage
> value, but persisting that value just until the next request - to preserve
> that value during the page reload  - seems to work fine: I changed the
> annotation from
>
> @Persist
>
> to
>
> @Persist(PersistenceConstants.FLASH)
>
> and I'm testing my pages to make sure this works. However I am also
> wondering if in theory changing that persistency to flash might be a bad
> idea for reasons that I don't know and that my tests so far are not
> showing. Does anyone have any opinion about this ?
>
Reply | Threaded
Open this post in threaded view
|

RE: Changing Grid.currentPage persistency to flash

Davide Vecchi
Thanks, I didn't know about Persistence Strategy Inheritance, it's good info. In this specific case I probably will not need to use it because we have already heavily customized the grid code, but I will certainly go for this inheritance mechanism when I need to control persistency on a component basis for non-customized components.

If anyone still has any observation, opinion or just guess about whether using flash persistency for the Grid.currentPage instance field might not be that good an idea I'd still like to hear about that.
 

-----Original Message-----
From: Chris Poulsen [mailto:[hidden email]]
Sent: Monday, May 2, 2016 13:11
To: Tapestry users <[hidden email]>
Subject: Re: Changing Grid.currentPage persistency to flash

I haven't used the grid with flash persistence, so I cannot comment on that.

But I just want to let you know that you can control the behavior of @Persist inside the Grid using "Persistence Strategy Inheritance" ( http://tapestry.apache.org/persistent-page-data.html ) without having to alter the component itself.

--
Chris

On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <[hidden email]> wrote:

> Hi everybody
>
> I see that the instance field that holds the current page number of a
> grid
> (org.apache.tapestry5.corelib.components.Grid.currentPage) is
> annotated with @Persist .
>
> This has the probably desirable effect that f.ex. if I am on webpage A
> and it has a grid and I browse to its page #2 and then I go to another
> webpage and then I go back to webpage A its grid is still on its page
> #2 where I had left it.
>
> However in my case this is not desirable and I would prefer that the
> grid page number is not remembered across different webpages.
>
> Removing the @Persist annotation of Grid.currentPage instance field
> altogether would cause the impossibility to browse grid pages at all
> because the grid pager does a page reload and this loses the
> currentPage value, but persisting that value just until the next
> request - to preserve that value during the page reload  - seems to
> work fine: I changed the annotation from
>
> @Persist
>
> to
>
> @Persist(PersistenceConstants.FLASH)
>
> and I'm testing my pages to make sure this works. However I am also
> wondering if in theory changing that persistency to flash might be a
> bad idea for reasons that I don't know and that my tests so far are
> not showing. Does anyone have any opinion about this ?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Changing Grid.currentPage persistency to flash

Barry Books-2
I have not changed it to flash but I did write a persistence strategy to
put the values is the url. I would agree that persisting the values in the
session has issues. The only problem with using the URL is if you have more
than one grid on a page you have to name the query parameters correctly.
Using the URL makes the grid stateless and bookmarkable.

On Monday, May 2, 2016, Davide Vecchi <[hidden email]> wrote:

> Thanks, I didn't know about Persistence Strategy Inheritance, it's good
> info. In this specific case I probably will not need to use it because we
> have already heavily customized the grid code, but I will certainly go for
> this inheritance mechanism when I need to control persistency on a
> component basis for non-customized components.
>
> If anyone still has any observation, opinion or just guess about whether
> using flash persistency for the Grid.currentPage instance field might not
> be that good an idea I'd still like to hear about that.
>
>
> -----Original Message-----
> From: Chris Poulsen [mailto:[hidden email] <javascript:;>]
> Sent: Monday, May 2, 2016 13:11
> To: Tapestry users <[hidden email] <javascript:;>>
> Subject: Re: Changing Grid.currentPage persistency to flash
>
> I haven't used the grid with flash persistence, so I cannot comment on
> that.
>
> But I just want to let you know that you can control the behavior of
> @Persist inside the Grid using "Persistence Strategy Inheritance" (
> http://tapestry.apache.org/persistent-page-data.html ) without having to
> alter the component itself.
>
> --
> Chris
>
> On Mon, May 2, 2016 at 11:12 AM, Davide Vecchi <[hidden email] <javascript:;>>
> wrote:
>
> > Hi everybody
> >
> > I see that the instance field that holds the current page number of a
> > grid
> > (org.apache.tapestry5.corelib.components.Grid.currentPage) is
> > annotated with @Persist .
> >
> > This has the probably desirable effect that f.ex. if I am on webpage A
> > and it has a grid and I browse to its page #2 and then I go to another
> > webpage and then I go back to webpage A its grid is still on its page
> > #2 where I had left it.
> >
> > However in my case this is not desirable and I would prefer that the
> > grid page number is not remembered across different webpages.
> >
> > Removing the @Persist annotation of Grid.currentPage instance field
> > altogether would cause the impossibility to browse grid pages at all
> > because the grid pager does a page reload and this loses the
> > currentPage value, but persisting that value just until the next
> > request - to preserve that value during the page reload  - seems to
> > work fine: I changed the annotation from
> >
> > @Persist
> >
> > to
> >
> > @Persist(PersistenceConstants.FLASH)
> >
> > and I'm testing my pages to make sure this works. However I am also
> > wondering if in theory changing that persistency to flash might be a
> > bad idea for reasons that I don't know and that my tests so far are
> > not showing. Does anyone have any opinion about this ?
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> <javascript:;>
> For additional commands, e-mail: [hidden email]
> <javascript:;>
>