On 3/29/07, Peter Muir <[EMAIL PROTECTED]> wrote:
Hi
I've started doing some work on this.
On 02/02/07, Adam Winer <[EMAIL PROTECTED]> wrote:
> (1) Page in data as necessary, automatically
I'm not entirely sure how this is supposed to be done with the
CollectionModel. As we're using JPA what we want is a something like:
// build the query
query.setFirstResult(10);
query.setMaxResults(10);
List list = query.getResultList();
// wrap the result list in a datamodel.
but the CollectionModel isn't updated with paging information - it
seems to be stored on the component.
Any hints ;)
Well, in theory, you'd do this semi-lazily: have a fetch
size stored in the model (which, depending on what
sort of caching you have available, might be a
multiple of the row count on the component), and then
on the first request for a particular row, fire the query
off with a heuristic for setFirstResults() and the fetch
size for setMaxResults().
The pain comes if you want to do this aggressively
(e.g., before Render Response).
> (2) Report good permanent row keys, so
> that adding/removing rows gets picked up
> without any off-by-one errors.
It should be possible to use the business key of the entity for this,
just some problems arise as the EntityManager isn't always available.
> (3) Perform sorting directly on the model
This works nicely - translating the sort criterion into an order by
and an order by into a List<SortCriterion>. Trinidad doesn't seem to
support a List<SortCriterion> with more than one element however (it
just displays the little arrow for the first criterion)?
Well, it's certainly great progress to support a single sort criterion.
I do think we should have some UI support for at least displaying
secondary sort criteria, even if there's nothing built in on tr:column
for activating multiple sort criteria straight from the UI.
-- Adam