Thanks! I knew I was doing something stupid. :) It's working now.
Linda
Matej Knopp wrote:
The total count can not depend on query parameters. It is the total
count of all books that match the filter, regardless of offset and
pagesize.
-Matej
On Mon, Oct 19, 2009 at 4:16 PM, Linda van der Pal
<lvd...@heritageagenturen.nl> wrote:
The trouble is that getting the books is dependent on the queryparam
variable.
Matej Knopp wrote:
Does it also happen when you call result.setTotalCount(books.size())
before calling getCount()?
>From IDataSource:
/**
* Sets the total items count. Alternatively, if the total
item
count can't be determined,
* either {...@link #MORE_ITEMS} or {...@link #NO_MORE_ITEMS}
constant can
be used to indicate
* whether there are more items left or not.
*
* If the real items count is specified, it might affect
the result of
* {...@link IQuery#getCount()}, so it is preferred to call
this method
before calling
* {...@link #setItems(Iterator)}.
*
* @param count
* the total count of items
*/
public void setTotalCount(int count);
-Matej
On Mon, Oct 19, 2009 at 2:52 PM, Linda van der Pal
<lvd...@heritageagenturen.nl> wrote:
Hello,
I have a problem with the inmethod IDataSource. I've provided my own
implementation for it, including implementing the query method. But for
some
reason, it only seems to want to return one row, while I know there
should
be two. Can anybody tell me what I might be doing wrong? It must be that
I've made a stupid mistake somewhere, because I did get it working for
two
other kinds of data. I simply don't see what I did differently.
Here's the query method. It's the initializing of the QueryParam variable
that fails. When I add in the line that I've commented out just below it,
I
do get the two rows I'm expecting.
public void query(final IQuery query, final IQueryResult result) {
String sortProperty = null;
boolean sortAsc = true;
// is there any sorting
if (query.getSortState().getColumns().size() > 0) {
// get the most relevant column
ISortStateColumn state =
query.getSortState().getColumns().get(0);
// get the column sort properties
sortProperty = convertToFieldName(state.getPropertyName());
sortAsc = state.getDirection() == IGridSortState.Direction.ASC;
}
List<Book> resultList;
try {
filter.setSort(sortProperty);
filter.setSortOrder(sortAsc);
// HERE'S MY PROBLEM: query.getCount() is 1 for some
reason
QueryParam qp = new QueryParam(query.getFrom(),
query.getCount());
//QueryParam qp = new QueryParam(0, 0);
List<Book> books = new
BookRetriever().getAllBooks(filter, qp);
// determine the total count
result.setTotalCount(books.size());
resultList = books;
} catch (Exception e) {
resultList = new ArrayList<Book>();
}
result.setItems(resultList.iterator());
}
Regards,
Linda
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.422 / Virus Database:
270.14.21/2445 - Release Date: 10/19/09 06:40:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.422 / Virus Database: 270.14.21/2445 - Release Date: 10/19/09 06:40:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org