Hi Simon, I think there is a further problem. The dataScroller 'knows' the number of records - presumably by doing a datalist.size(). That is going to be a problem for large datasets - we don't know the size without traversing the whole dataset and constructing the datalist.
Having to bind the dataTable to a List is also problematic. We really do not want to construct a List for large dataset. I think the dataTable in ASP.Net is more practical. It can bind to a DataReader object, which I think is implemented as an ODBC curser. The programmer can fast forward the datareader to a particular point, and the dataTable will pick up the required number of records from that point for its display. The dataScroller has to be completely independent from the datalist and dataTable as well. By that I mean it should not have to work with a 'real' datalist or dataTable. Its purpose is to notify the change in page index. It is up to the programmer to specify the datalist size, the current page index and number of records per page. It does seem to me that the combination of dataTable and dataScroller is not suited for large datasets. Please let me know if you have a solution to this. Regards, Yee -----Original Message----- From: Simon Kitching [mailto:[EMAIL PROTECTED] Sent: Thursday, 24 November 2005 1:03 PM To: MyFaces Discussion Subject: Re: dataTable, t:dataScroller and large datasets 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 > >

