I suppose the usual approach is to trigger
the download of IDataProvider’s data via the event handler of the submit
button. That way, the data would be
available for both “Iterator IDataProvider.iterate(first,
count)” and “int IDataProvider.size()”. However, I do not have a single submit
button – I have various sets of radio-buttons and a change to any one
causes an immediate postback. I do
not want to code an event handler for each one of them; I’d rather put my
database query in a method that is called before the page is rendered _regardless_ of the reason. Can you suggest a suitable method? I tried putting the database query in “Iterator
IDataProvider.iterate(first, count)” but that doesn’t seem to work,
perhaps because it comes too late for “int IDataProvider.size()” to
have the information. Putting the
database query in “int IDataProvider.size()”
may simply reverse the problem. Into which method _should_ I place the database query?
What are my options? -----Original Message----- 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?) |
- RE: [Wicket-user] Question about DataTable and IDataProv... Frank Silbermann
- Re: [Wicket-user] Question about DataTable and IData... Igor Vaynberg