incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel King" <dank...@nemours.org>
Subject RE: dataTable - loading data in a bean constructor
Date Fri, 20 Apr 2007 21:17:43 GMT
I'm already lazy fetching and have the ability to paginate through my
data.

This is the scenario:

User clicks on link and goes to page.
The page has a data table which should have data already loaded.
User can paginate the data in the data table.

For some of my pages which aren't a subview I can preload this data in
the constructor and put a check for postback around it to not load it
again when the user is paginating since an action listener fires to load
the data during pagination.

However one of my pages has a bunch of tabs and every one of those tabs
when clicked shows a table which is within a subview.  The postback
check won't work and the data isn't loaded.

See what I mean?  It is the first load that is my problem when the user
lands on a page.

Do you know a way to preload data into a data table when the page loads?
The pagination is a PPR call and doesn't need to repeat this preload yet
the subview is a PPR call too and does need to preload the data.

Daniel King, R2D2, C3P0
Application Engineer
Web Team
Nemours
Office: (904) 288-5643
Fax:    (904) 288-5758
 
*** Call me Daniel ***

NOTICE...This electronic transmission is intended only for the person(s)
named.  It may contain information that is (i) proprietary to the
sender, and/or (ii) privileged, confidential and/or otherwise exempt
from disclosure under applicable State and Federal law, including, but
not limited to, privacy standards imposed pursuant to the federal Health
Insurance Portability and Accountability Act of 1996 (HIPAA).  Receipt
by anyone other than the named recipient(s) is not a waiver of any
applicable privilege.  If you received this confidential communication
in error, please notify the sender immediately by reply e-mail message
and permanently delete the original message from your system.


-----Original Message-----
From: Simon Lessard [mailto:simon.lessard.3@gmail.com] 
Sent: Friday, April 20, 2007 5:08 PM
To: adffaces-user@incubator.apache.org
Subject: Re: dataTable - loading data in a bean constructor

Hmmm, you can use a session scoped bean too why my suggestion, you just
have
ensure that it stay synchronized with the database. However, a List
would
not be the good solution for that. I think you should create your own
implementation of a CollectionModel that would support lazy fetching and
keep in sync with your model.


Regards,

~ Simon

On 4/20/07, Daniel King <danking@nemours.org> wrote:
>
> Simon,
>
>   Thanks for the response.  This is for a shopping cart application
with
> a huge number of possible clients.  Also this table has the ability to
> paginate.  The problem with your idea would be that the bean is
request
> scope and gets constructed again when the table is paginated.  This
> calls the method to fill the table from the constructor and the PPR
> method.  And if I check to see that it is a PPR method and not load
the
> data then it isn't loaded whenever it is within a subview for a tab.
>
> Daniel King, R2D2, C3P0
> Application Engineer
> Web Team
> Nemours
> Office: (904) 288-5643
> Fax:    (904) 288-5758
>
> *** Call me Daniel ***
>
> NOTICE...This electronic transmission is intended only for the
person(s)
> named.  It may contain information that is (i) proprietary to the
> sender, and/or (ii) privileged, confidential and/or otherwise exempt
> from disclosure under applicable State and Federal law, including, but
> not limited to, privacy standards imposed pursuant to the federal
Health
> Insurance Portability and Accountability Act of 1996 (HIPAA).  Receipt
> by anyone other than the named recipient(s) is not a waiver of any
> applicable privilege.  If you received this confidential communication
> in error, please notify the sender immediately by reply e-mail message
> and permanently delete the original message from your system.
>
>
> -----Original Message-----
> From: Simon Lessard [mailto:simon.lessard.3@gmail.com]
> Sent: Friday, April 20, 2007 3:43 PM
> To: adffaces-user@incubator.apache.org
> Subject: Re: dataTable - loading data in a bean constructor
>
> Hello Daniel,
>
> What prevent you from using an instance variable initially set to null
> and
> load the data in the bean's get method only if the cached value is
still
> null? Like:
>
> public class MyBean {
>   private List<Client> loadedClients;
>
>   public List<Client> getClients() {
>     if (loadedClients == null) {
>       loadedClients = loadClients();
>     }
>
>     return loadedClients;
>   }
> }
>
> On 4/20/07, Daniel King <danking@nemours.org> wrote:
> >
> > Currently I am loading a data table's data in the constructor of my
> > bean.  I can check to see when my bean is constructed if it is a
> > postback and if so skip this data load.
> >
> >
> >
> > However I have a situation where I have a subview which has a data
> table
> > that needs data loaded as soon as you hit the page.  This postback
> check
> > will cause the data load to be skipped.
> >
> >
> >
> > Anyone else have a similar problem and solution where they need data
> > loaded as soon as a page loads and not on PPR?
> >
> >
> >
> > Postback check example:
> >
> >
> >
> > public MyBean() {
> >
> > if(!RequestContext.getCurrentInstance().isPostback()) {
> >
> >   // load data
> >
> > }
> >
> > }
> >
> >
> >
> > Thanks,
> >
> > Daniel King, R2D2, C3P0
> >
> > Application Engineer
> >
> > Web Team
> >
> > Nemours
> >
> > Office: (904) 288-5643
> >
> > Fax:    (904) 288-5758
> >
> >
> >
> > *** Call me Daniel ***
> >
> > NOTICE...This electronic transmission is intended only for the
> person(s)
> > named.  It may contain information that is (i) proprietary to the
> > sender, and/or (ii) privileged, confidential and/or otherwise exempt
> > from disclosure under applicable State and Federal law, including,
but
> > not limited to, privacy standards imposed pursuant to the federal
> Health
> > Insurance Portability and Accountability Act of 1996 (HIPAA).
Receipt
> > by anyone other than the named recipient(s) is not a waiver of any
> > applicable privilege.  If you received this confidential
communication
> > in error, please notify the sender immediately by reply e-mail
message
> > and permanently delete the original message from your system.
> >
> >
> >
> >
>
>


Mime
View raw message