Hi Yee,
Just FYI, I'm working on a possible solution involving subclassing
ListDataModel to add an "offset" property. The getRowData method simply
subtracts the offset from the current _rowIndex to determine which
element from the list to actually return. That way the dataScroller can
set the UIData's first property automatically just as per normal; the
UIData will then try to iterate from row index first to first +
pagesize, and the custom DataModel will just adjust that index to fit
the available data.
I'm off home now, so won't be able to try this approach out until tomorrow.
Cheers,
Simon
Yee CN wrote:
Simon,
Ha - somebody read my mind. That was the exact question that I wanted to
ask.
I figured that dataScroller has got to be out of the equation.
As a reference - how it is done in ASP.NET is that the binding of data to
the dataTable component is very manual. The dataTable is bind to a
UIComponent object in the code behind form (roughly equivalent to JSF
backing bean). Page navigation will trigger a submit() and invoke a
pageIndex change event listener, and from there the programmer has to do
whatever to retrieve the right page of data and bind it to the dataTable
UIComponent. Also the total number of records is set manually as well - so I
can have a separate count(*) query to find out this value without having to
traverse the whole dataset.
Coming from ASP.NET background, the most difficult aspect of JSF to me is
the difficulty in manipulating the UIComponents in the backing bean, as it
can easily get into circular reference situation with the #{...} el bindings
in the jsf page and the JSF life cycle. Often I am tempted to forgo el
bindings altogether and resort to setting UIComponents values in the backing
bean.
I would appreciate very much if anybody who can share best practices on how
to do handle this particular problem.
Best regards,
Yee
-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED]
Sent: Thursday, 24 November 2005 11:34 AM
To: MyFaces Discussion
Subject: t:dataTable, t:dataScroller and large datasets
Hi All,
I'm trying to use a t:dataTable and a t:dataScroller together to page
through a large set of data.
The twist is that I don't want to load the entire dataset into memory; I
only want to store the rows that are currently being displayed.
It seems to me that the dataScroller essentially requires the entire
dataset to be in memory, though: it expects its UIData to report
appropriate value from getFirst(), and the dataScroller automatically
calls the UIData's setFirst(n) method when navigation occurs on the
dataScroller.
Does anyone know how to work with only subsets of data in memory?
Thanks,
Simon