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