Dave wrote:

I have 100 rows. Each time I like to fetch 10 rows from database. So the data model has knowledge of 10 rows.
<t:dataScroller id="scroll_1"

for="data"

rowsCountVar="rowsCount"

displayedRowsCountVar="displayedRowsCountVar"

firstRowIndexVar="firstRowIndex"

lastRowIndexVar="lastRowIndex"

pageCountVar="pageCount"

pageIndexVar="pageIndex"

-----------

So the rowCount is 10, firstRowIndex=0, lastRowIndex=9 even though I fetch rows 50-59 from database.

I like the rowCount is 100 (the whole data model from user's view), the firstRowIndex is 50, and the lastRowIndex is 59. When User click next page (paginator), backing bean needs to be notified which portion of data to fetch from database.

Does <t:dataTable> and <t:dataScroller> support this?

Thanks! Dave.

------------------------------------------------------------------------
Yahoo! for Good
Click here to donate <http://store.yahoo.com/redcross-donate3/> to the Hurricane Katrina relief effort.

AFAIK the answer is no.

The dataTable is a view onto the ResultSet that has been handed to it via the backing bean. The backing bean is assumed to hand the *entire* query result in one ResultSet. That is, the dataTable 'first' and 'rpws' operators are relative to the ResultSet, not to the database query result. (I am using 'query result' to indicate the set of values returned by the SQL query and ResultSet to be the JSF Collection of objects equivalent to the query result.)

In order to get what you want, there would have to be some way for the dataTable to hand the offset and row count values to the backing bean for use in creating the ResultSet. (See my earlier emails on having a parametric dataTable option.)

The assumption that the ResultSet is the entire query result is in keeping with the MVC model in that the view component is independent from the model, but it does present additional difficulties when working with large query results from a database performance point of view. There are other use cases where the non-dynamic nature of dataTable causes limitations, however these 'limitations' may be viewed as being the result of MVC and not necessarily JSF.

-david-

Reply via email to