Paginate large table with webuijsf:table

View: New views
7 Messages — Rating Filter:   Alert me  

Paginate large table with webuijsf:table

by matroska :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a very large db table ( 1 milion record) and I would like to
paginate results not only with paginate control but calling many
paginated db query to reduce memory and cpu overhead. I have found many
tutorials on paginating large result with datatable but none using
dataproviders. Is it possible? How can I achieve this?

Thanks in advance
Tobia Loschiavo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Paginate large table with webuijsf:table

by bbergquist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

matroska wrote:

> Hi,
>
> I have a very large db table ( 1 milion record) and I would like to
> paginate results not only with paginate control but calling many
> paginated db query to reduce memory and cpu overhead. I have found
> many tutorials on paginating large result with datatable but none
> using dataproviders. Is it possible? How can I achieve this?
>
> Thanks in advance
> Tobia Loschiavo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>
It can be done but gets a little tricky.   First, you cannot use the
pagination controls that are available with the table.  The underlying
infrastructure requires that it knows the total rows and may even
iterate through all of  them, so with a million rows, you are right back
where you started with consuming tremendous amounts of memory and having
terrible performance.  The infrastructure really needs redesign to not
require that it have to be able to provide a count or traverse all of
the rows so that large tables can be supported easier.

What you can do is provide your own TableDataProvider.  I use a class
derived from ObjectListDataProvider and fetch a page of records at a
time from the database, build the list and render.  For paging, I use
the table footer facet and add my own paging controls that look like the
ones provided by the table.  When fetching the records for the page, I
fetch an extra record to determine if there is another page so that I
can properly enable/disable the paging controls (next, last, previous,
first).

If you are doing filtering and sorting you also have more issues. Of
course your fetching of the page of records needs to take into
consideration the filtering and sorting applied.  Fortunately if the
TableDataProvider that you supply to the TableRowGroup is the same
instance as the TableDataSorter and TableDataFilter, then it is assumed
that your TableDataProvider will provide sorted and filtered records.  
To integrate into the table nicely, you will need to implement
TableDataSorter and TableDataFilter in your TableDataProvider class.  
You will need to keep track of the TableDataSortCriteria and
TableDataFilterCriteria that is applied by the user through interacting
with the table controls on the page and use this criteria when
retrieving your data for the page.  One wrinkle is that the code updates
the TableDataSorterCriteria directly without calling into the
TableDataSort when the sort criteria is changed from ascending to
descending or vise-versa.  Not good because your custom TableDataSorter
implementation has no idea that the criteria has been changed.

But in the end, it can be done.  It is a lot of work and should be much
easier but if you really want to you can handle large tables.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Paginate large table with webuijsf:table

by matroska :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

thank you for your good answer however i haven't understood if it is
possible to obtain same features of non paginated table for what
concerns filter criteria and sort criteria. Are they possible?

Thanks in advance
Tobia Loschiavo


Brett Bergquist ha scritto:

> matroska wrote:
>> Hi,
>>
>> I have a very large db table ( 1 milion record) and I would like to
>> paginate results not only with paginate control but calling many
>> paginated db query to reduce memory and cpu overhead. I have found
>> many tutorials on paginating large result with datatable but none
>> using dataproviders. Is it possible? How can I achieve this?
>>
>> Thanks in advance
>> Tobia Loschiavo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>
> It can be done but gets a little tricky.   First, you cannot use the
> pagination controls that are available with the table.  The underlying
> infrastructure requires that it knows the total rows and may even
> iterate through all of  them, so with a million rows, you are right
> back where you started with consuming tremendous amounts of memory and
> having terrible performance.  The infrastructure really needs redesign
> to not require that it have to be able to provide a count or traverse
> all of the rows so that large tables can be supported easier.
>
> What you can do is provide your own TableDataProvider.  I use a class
> derived from ObjectListDataProvider and fetch a page of records at a
> time from the database, build the list and render.  For paging, I use
> the table footer facet and add my own paging controls that look like
> the ones provided by the table.  When fetching the records for the
> page, I fetch an extra record to determine if there is another page so
> that I can properly enable/disable the paging controls (next, last,
> previous, first).
>
> If you are doing filtering and sorting you also have more issues. Of
> course your fetching of the page of records needs to take into
> consideration the filtering and sorting applied.  Fortunately if the
> TableDataProvider that you supply to the TableRowGroup is the same
> instance as the TableDataSorter and TableDataFilter, then it is
> assumed that your TableDataProvider will provide sorted and filtered
> records.  To integrate into the table nicely, you will need to
> implement TableDataSorter and TableDataFilter in your
> TableDataProvider class.  You will need to keep track of the
> TableDataSortCriteria and TableDataFilterCriteria that is applied by
> the user through interacting with the table controls on the page and
> use this criteria when retrieving your data for the page.  One wrinkle
> is that the code updates the TableDataSorterCriteria directly without
> calling into the TableDataSort when the sort criteria is changed from
> ascending to descending or vise-versa.  Not good because your custom
> TableDataSorter implementation has no idea that the criteria has been
> changed.
>
> But in the end, it can be done.  It is a lot of work and should be
> much easier but if you really want to you can handle large tables.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
> .
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Paginate large table with webuijsf:table

by Dan Labrecque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It is true that the table obtains rows to calculate pagination data.
However, the getRowCount() method of TableDataProvider can be overridden
to return something other than 1 million rows. You can also override the
pagination text in the table header.

Typically, sorting and filtering are performed on all rows. However, if
you provide your own TableDataSorter and TableDataFilter classes, you
can have the database sort/filter data, instead.

Dan

matroska wrote:

>
> Hi,
>
> thank you for your good answer however i haven't understood if it is
> possible to obtain same features of non paginated table for what
> concerns filter criteria and sort criteria. Are they possible?
>
> Thanks in advance
> Tobia Loschiavo
>
>
> Brett Bergquist ha scritto:
>> matroska wrote:
>>> Hi,
>>>
>>> I have a very large db table ( 1 milion record) and I would like to
>>> paginate results not only with paginate control but calling many
>>> paginated db query to reduce memory and cpu overhead. I have found
>>> many tutorials on paginating large result with datatable but none
>>> using dataproviders. Is it possible? How can I achieve this?
>>>
>>> Thanks in advance
>>> Tobia Loschiavo
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>> It can be done but gets a little tricky.   First, you cannot use the
>> pagination controls that are available with the table.  The
>> underlying infrastructure requires that it knows the total rows and
>> may even iterate through all of  them, so with a million rows, you
>> are right back where you started with consuming tremendous amounts of
>> memory and having terrible performance.  The infrastructure really
>> needs redesign to not require that it have to be able to provide a
>> count or traverse all of the rows so that large tables can be
>> supported easier.
>>
>> What you can do is provide your own TableDataProvider.  I use a class
>> derived from ObjectListDataProvider and fetch a page of records at a
>> time from the database, build the list and render.  For paging, I use
>> the table footer facet and add my own paging controls that look like
>> the ones provided by the table.  When fetching the records for the
>> page, I fetch an extra record to determine if there is another page
>> so that I can properly enable/disable the paging controls (next,
>> last, previous, first).
>>
>> If you are doing filtering and sorting you also have more issues. Of
>> course your fetching of the page of records needs to take into
>> consideration the filtering and sorting applied.  Fortunately if the
>> TableDataProvider that you supply to the TableRowGroup is the same
>> instance as the TableDataSorter and TableDataFilter, then it is
>> assumed that your TableDataProvider will provide sorted and filtered
>> records.  To integrate into the table nicely, you will need to
>> implement TableDataSorter and TableDataFilter in your
>> TableDataProvider class.  You will need to keep track of the
>> TableDataSortCriteria and TableDataFilterCriteria that is applied by
>> the user through interacting with the table controls on the page and
>> use this criteria when retrieving your data for the page.  One
>> wrinkle is that the code updates the TableDataSorterCriteria directly
>> without calling into the TableDataSort when the sort criteria is
>> changed from ascending to descending or vise-versa.  Not good because
>> your custom TableDataSorter implementation has no idea that the
>> criteria has been changed.
>>
>> But in the end, it can be done.  It is a lot of work and should be
>> much easier but if you really want to you can handle large tables.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>> .
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Paginate large table with webuijsf:table

by matroska :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan please have you got some sourcecode or tutorial to help me?
Unfortunately resources about pagination on woodstock lack of contents.

Thanks in advance
Tobia Loschiavo

Dan Labrecque wrote:
It is true that the table obtains rows to calculate pagination data.
However, the getRowCount() method of TableDataProvider can be overridden
to return something other than 1 million rows. You can also override the
pagination text in the table header.

Typically, sorting and filtering are performed on all rows. However, if
you provide your own TableDataSorter and TableDataFilter classes, you
can have the database sort/filter data, instead.

Dan

matroska wrote:
>
> Hi,
>
> thank you for your good answer however i haven't understood if it is
> possible to obtain same features of non paginated table for what
> concerns filter criteria and sort criteria. Are they possible?
>
> Thanks in advance
> Tobia Loschiavo
>
>
> Brett Bergquist ha scritto:
>> matroska wrote:
>>> Hi,
>>>
>>> I have a very large db table ( 1 milion record) and I would like to
>>> paginate results not only with paginate control but calling many
>>> paginated db query to reduce memory and cpu overhead. I have found
>>> many tutorials on paginating large result with datatable but none
>>> using dataproviders. Is it possible? How can I achieve this?
>>>
>>> Thanks in advance
>>> Tobia Loschiavo
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net
>>> For additional commands, e-mail: users-help@woodstock.dev.java.net
>>>
>>>
>>>
>> It can be done but gets a little tricky.   First, you cannot use the
>> pagination controls that are available with the table.  The
>> underlying infrastructure requires that it knows the total rows and
>> may even iterate through all of  them, so with a million rows, you
>> are right back where you started with consuming tremendous amounts of
>> memory and having terrible performance.  The infrastructure really
>> needs redesign to not require that it have to be able to provide a
>> count or traverse all of the rows so that large tables can be
>> supported easier.
>>
>> What you can do is provide your own TableDataProvider.  I use a class
>> derived from ObjectListDataProvider and fetch a page of records at a
>> time from the database, build the list and render.  For paging, I use
>> the table footer facet and add my own paging controls that look like
>> the ones provided by the table.  When fetching the records for the
>> page, I fetch an extra record to determine if there is another page
>> so that I can properly enable/disable the paging controls (next,
>> last, previous, first).
>>
>> If you are doing filtering and sorting you also have more issues. Of
>> course your fetching of the page of records needs to take into
>> consideration the filtering and sorting applied.  Fortunately if the
>> TableDataProvider that you supply to the TableRowGroup is the same
>> instance as the TableDataSorter and TableDataFilter, then it is
>> assumed that your TableDataProvider will provide sorted and filtered
>> records.  To integrate into the table nicely, you will need to
>> implement TableDataSorter and TableDataFilter in your
>> TableDataProvider class.  You will need to keep track of the
>> TableDataSortCriteria and TableDataFilterCriteria that is applied by
>> the user through interacting with the table controls on the page and
>> use this criteria when retrieving your data for the page.  One
>> wrinkle is that the code updates the TableDataSorterCriteria directly
>> without calling into the TableDataSort when the sort criteria is
>> changed from ascending to descending or vise-versa.  Not good because
>> your custom TableDataSorter implementation has no idea that the
>> criteria has been changed.
>>
>> But in the end, it can be done.  It is a lot of work and should be
>> much easier but if you really want to you can handle large tables.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net
>> For additional commands, e-mail: users-help@woodstock.dev.java.net
>>
>> .
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net
> For additional commands, e-mail: users-help@woodstock.dev.java.net
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@woodstock.dev.java.net
For additional commands, e-mail: users-help@woodstock.dev.java.net

Re: Paginate large table with webuijsf:table

by Felipe Jaekel (FkJ) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This works fine

http://www.ilikespam.com/blog/paging-large-data-sets-with-a-lazylist

2008/4/10, matroska <matroska@...>:

Dan please have you got some sourcecode or tutorial to help me?
Unfortunately resources about pagination on woodstock lack of contents.

Thanks in advance
Tobia Loschiavo


Dan Labrecque wrote:
>
> It is true that the table obtains rows to calculate pagination data.
> However, the getRowCount() method of TableDataProvider can be overridden
> to return something other than 1 million rows. You can also override the
> pagination text in the table header.
>
> Typically, sorting and filtering are performed on all rows. However, if
> you provide your own TableDataSorter and TableDataFilter classes, you
> can have the database sort/filter data, instead.
>
> Dan
>
> matroska wrote:
>>
>> Hi,
>>
>> thank you for your good answer however i haven't understood if it is
>> possible to obtain same features of non paginated table for what
>> concerns filter criteria and sort criteria. Are they possible?
>>
>> Thanks in advance
>> Tobia Loschiavo
>>
>>
>> Brett Bergquist ha scritto:
>>> matroska wrote:
>>>> Hi,
>>>>
>>>> I have a very large db table ( 1 milion record) and I would like to
>>>> paginate results not only with paginate control but calling many
>>>> paginated db query to reduce memory and cpu overhead. I have found
>>>> many tutorials on paginating large result with datatable but none
>>>> using dataproviders. Is it possible? How can I achieve this?
>>>>
>>>> Thanks in advance
>>>> Tobia Loschiavo
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>
>>> It can be done but gets a little tricky.   First, you cannot use the
>>> pagination controls that are available with the table.  The
>>> underlying infrastructure requires that it knows the total rows and
>>> may even iterate through all of  them, so with a million rows, you
>>> are right back where you started with consuming tremendous amounts of
>>> memory and having terrible performance.  The infrastructure really
>>> needs redesign to not require that it have to be able to provide a
>>> count or traverse all of the rows so that large tables can be
>>> supported easier.
>>>
>>> What you can do is provide your own TableDataProvider.  I use a class
>>> derived from ObjectListDataProvider and fetch a page of records at a
>>> time from the database, build the list and render.  For paging, I use
>>> the table footer facet and add my own paging controls that look like
>>> the ones provided by the table.  When fetching the records for the
>>> page, I fetch an extra record to determine if there is another page
>>> so that I can properly enable/disable the paging controls (next,
>>> last, previous, first).
>>>
>>> If you are doing filtering and sorting you also have more issues. Of
>>> course your fetching of the page of records needs to take into
>>> consideration the filtering and sorting applied.  Fortunately if the
>>> TableDataProvider that you supply to the TableRowGroup is the same
>>> instance as the TableDataSorter and TableDataFilter, then it is
>>> assumed that your TableDataProvider will provide sorted and filtered
>>> records.  To integrate into the table nicely, you will need to
>>> implement TableDataSorter and TableDataFilter in your
>>> TableDataProvider class.  You will need to keep track of the
>>> TableDataSortCriteria and TableDataFilterCriteria that is applied by
>>> the user through interacting with the table controls on the page and
>>> use this criteria when retrieving your data for the page.  One
>>> wrinkle is that the code updates the TableDataSorterCriteria directly
>>> without calling into the TableDataSort when the sort criteria is
>>> changed from ascending to descending or vise-versa.  Not good because
>>> your custom TableDataSorter implementation has no idea that the
>>> criteria has been changed.
>>>
>>> But in the end, it can be done.  It is a lot of work and should be
>>> much easier but if you really want to you can handle large tables.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>> .
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
>


--
View this message in context: http://www.nabble.com/Paginate-large-table-with-webuijsf%3Atable-tp14970571p16606453.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Paginate large table with webuijsf:table

by liquidshadow :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to create a large table so I used a class derived from ObjectListDataProvider as suggested, adding the getRowCount() method to obtain the correct number of rows. Is it possible to override the paging controls without creating a new facet?


bbergquist wrote:
What you can do is provide your own TableDataProvider.  I use a class
derived from ObjectListDataProvider and fetch a page of records at a
time from the database, build the list and render.  For paging, I use
the table footer facet and add my own paging controls that look like the
ones provided by the table.  When fetching the records for the page, I
fetch an extra record to determine if there is another page so that I
can properly enable/disable the paging controls (next, last, previous,
first).