Re: WODisplayGroup and nextBatch/previousBatch
Re: WODisplayGroup and nextBatch/previousBatch
- Subject: Re: WODisplayGroup and nextBatch/previousBatch
- From: Hunter Hillegas <email@hidden>
- Date: Thu, 14 Oct 2004 10:45:31 -0700
So simple. Works great.
Thanks,
Hunter
On Oct 14, 2004, at 10:30 AM, David LeBer wrote:
On Oct 14, 2004, at 12:40 PM, Hunter Hillegas wrote:
I have a component that contains a WODisplayGroup. That component
gets its bindings and I perform the fetching in appendToResponse().
As of now, the forward and back buttons I attached to the
displayNextBatch and displayPreviousBatch actions do not work.
The page does reload but the original (first batch) is always
displayed.
I assume this is because I have my fetch in the wrong place?
Where should I put my fetch so that I can:
1. Have access to my bindings.
2. Be able to correctly navigate to other batches without overwriting
the results with a fresh fetch in appendToResponse().
When I want to populate a variable late (ie: after awake) I usually
follow this kind of pattern:
protected NSArray _fetchedObjects;
//...
public NSArray fetchedObjects() {
if (_fetchedObjects == null) {
//perform steps to fetch objects
}
return _fetchedObjects;
}
public void setFetchedObjects(NSArray anArray) {
_fetchedObjects = anArray;
}
I've done similar things for WODisplayGroups:
protected WODisplayGroup _displayGroup;
//...
public WODisplayGroup displayGroup() {
if (_displayGroup == null) {
// Create and configure display group
//ie:
_displayGroup = new WODisplayGroup();
_displayGroup.setNumberOfObjectsPerBatch(10);
EOSortOrdering ascendingOrdering =
EOSortOrdering.sortOrderingWithKey("keyToSortOn",
EOSortOrdering.CompareAscending);
NSArray ordering = new NSArray(new Object[] {ascendingOrdering});
_displayGroup.setSortOrderings(ordering);
_displayGroup().setObjectArray(fetchedObjects());
}
return _displayGroup;
}
;david
--
David LeBer
Codebase Software Systems
site: http://www.codebase.ca
blog: http://david.codebase.ca
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden