myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Balunas" <balun...@gmail.com>
Subject Re: Pagination of large database tables
Date Tue, 20 Feb 2007 13:58:08 GMT
Hello,

I have implemented a very similar feature as to what you are requesting.

What this sounds like is the built in "fast forward, fast rewind" buttons.
These will bump you ahead some number of pages automatically.  The issue you
may have is that these will display even if the data set is small or not
available.  You could probably set the render attribute based on the number
of records returned like you show in your example.

Another way to do something similar is actually to have two dataScrollers.
One shows the pages and numbers like you display - then another one next to
it that does not show any pages, or images, but instead uses the local
variables like pageCount, curRow, etc... to determine if a "more" link
should be displayed.  It would end up looking like <<1 2 3 4 5 >> More

The getFetchData is nice because if gets called automatically when the data
table needs more info.  What I have done is changed the request objects used
to fetch the correct data (startRow, sortData, pageObj) based on user input
then made a new method called "resetData" that can be called to force a new
fetch.  This gets called after the user changes a filter, or sorts the
data.

Is this the type of behavior that you are looking for?

-Jay

On 2/20/07, pallavi.roy@wipro.com <pallavi.roy@wipro.com> wrote:
>
>  Hi Paul,
>
> Thank you for your response.
> But after going through this I have couple of questions on
> implementations.
> Being pretty new jsf i am sorry if some of my doubts are irrelavent.
>
> Since i want my GUI to look like  <<1 2 3 4 5 *More* >>.I need to
> implement a new facetn something like this while customizing
> <t:DataScroller>
> <f:facet name="DBfetch">
> <h:outputText value="More" rendered="condition"></h:outputText>
> </f:facet>
>
> Since Select COUNT(*) from DB is a time consuming operation.The client has
> ruled out this option.
> So with the click of *More* i want to perform a database fetch in subsets
> of 250 records at a time.
> I want to perform this operation in my page bean.
>
> I want to know how can i link this getfetchData() method in my page bean
> with the <t:DataScroller>.
> Is it possible.??
>
>
> Best Regards,
> Pallavi
>  ------------------------------
> *From:* Paul Iov [mailto:paul@voller-ernst.de]
> *Sent:* Monday, February 19, 2007 6:48 PM
> *To:* MyFaces Discussion
> *Subject:* Re: Pagination of large database tables
>
> Hi Pallavi!
>
> First of all take a look at
> http://wiki.apache.org/myfaces/WorkingWithLargeTables. The illustrating
> code there is IMHO a little bit buggy (especially for subsets of large
> datasets, which commes from EJB it makes no sense to fetch the same page
> twice, since the sorting order never chahges), but generally this approach
> works fine.
>
> I have exactly the same usecase - large resultsets and fetching on demand,
> but I'm using ac:AjaxDataScroller insteed of <t:dataScroller>, because the
> second one is not Ajax-compatible :( Any way, with own extended
> implementation of DataModel im background it would be preaty easy to
> implement "fetch more" feature, you are asking for.
>
> regards,
> paul
>
> pallavi.roy@wipro.com schrieb:
>
> Hi All,
>
> I currently have a requirement for pagination.
> I want the following GUI display <<1 2 3 4 5 more >>.
> Where on click of << is for previous.
> And on click of >> is for next.
> So with these two i could go ahead with <t:dataScroller> for the above
> mentioned functionlity.
> But if i had the advantage of knowing the total number of rows with DB to
> perform COUNT operation on the total number of rows.
>
> But for larger tables this wouldn't be efficient.
> Hence the requirement demands fetching rows in multiples of 250.
> And each page displaying 50 rows per page.
> With the click on more it would fetch the next 250 rows.
> And the display should look like << 6 7 8 9 10 More >>.(something similar
> to google's pagination).
>
> Is there a way by which i can implement this.
> Or can i extend the functionality of <t:dataScroller> to implement this.
> Any suggestions are welcome.
>
>
> Best Regards,
> Pallavi
>
>
>
>
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>
>
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>

Mime
View raw message