Okay, after a nights sleep, I got it working, but how I did it seems hackish 
(shocking, I know). Is the nextPage() method below from my delegate the best 
way to do this?

    public WOComponent nextPage(WOComponent sender) {
        WOComponent nextPage;
        if (((ERD2WQueryPage) sender).queryDataSource()
                  .fetchObjects()
                  .count() == 1) {
            InspectPageInterface ipi = D2W.factory()
                                          
.inspectPageForEntityNamed(Student.ENTITY_NAME,
                                                                     
sender.session());
            ((ERD2WInspectPage) ipi).setObject((EOEnterpriseObject) 
((ERD2WQueryPage) sender).queryDataSource()
                                                                                
             .fetchObjects()
                                                                                
             .lastObject());
            nextPage = (WOComponent) ipi;
        } else {
            ListPageInterface lpi = D2W.factory()
                                       
.listPageForEntityNamed(Student.ENTITY_NAME,
                                                               
sender.session());
            ((ERD2WListPage) lpi).setDataSource(((ERD2WQueryPage) 
sender).queryDataSource());
            nextPage = (WOComponent) lpi;

        }
        return nextPage;
    }

On Oct 10, 2010, at 8:39 PM, David Avendasora wrote:

> Hi All,
> 
> When a user performs a query, if the results contain exactly one object I 
> want to return an Inspect page for that object instead of a List page.
> 
> I assume I'm going to want to implement a NextPageDelegate, but I'm not sure 
> how to do that. I've looked around but I can't seem to find a good example. 
> Does anyone have an example NextPageDelegate that I can use as a starting 
> point?
> 
> I promise to create a Wiki page documenting how to do this for future mes.
> 
> Thanks!
> 
> Dave _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
> 
> This email sent to [email protected]
> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to