the iterator() and size() are not meant to be used "together" and there is no, nor ever be, a contract that guarantees any ordering of invocations between these two methods.

size() is meant to return the total number of rows

iterator() is used to return a window that will be displayed

those are the only contracts.

what exactly is the problem?

-Igor


On 4/4/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:

I have a question about the intended use of the DataTable components provided in Wicket Extensions.  The DataTable relies upon an IDataProvider to provide the data.  To do this, we implement:

"Iterator iterate(first, count)"

Lacking any advice to the contrary, I assumed that this is the method which would retrieve data from the database, but this does not seem to be working well for me.

My database query is parameterized based on page-component model values, and these may change with each rendering. My problem is that when one rendering presents a short data set, on the next rendering the DataTable is not always requesting all of the rows.  The "count" seems to be affected by the number of rows returned by the previous rendering.

I suspect this is because my implementation of  "int DataProvider.size()" assumes that it will be called _after_ "Iterator iterate(first, count)" pulls down the data – so it's always one rendering behind.

Should I give the "int IDataProvider.size()" method the responsibility for figuring out the query string and going to the database?  (How else would it be able to tell the DataProvider how many rows to request?)

 


Reply via email to