• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup


  • Subject: Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup
  • From: Lachlan Deck <email@hidden>
  • Date: Tue, 4 May 2010 22:10:32 +1000

On 04/05/2010, at 11:18 AM, Chuck Hill wrote:

> On May 3, 2010, at 5:38 PM, Baiss Eric Magnusson wrote:
>
>> I have an Owner, the Owner has many Transactions.
>>
>> <...>
>> In the pages Constructor I used:
>> ...
>> 	public ERXBatchingDisplayGroup<Transaction> curTrans;
>> ...
>> 	curTrans.queryBindings().setObjectForKey( … );
>> 	try  {
>> 		curTrans.setObjectArray( theOwner.transactions() );
>> 		curTrans.qualifyDataSource();
>
> That looks... odd.  Especially this part: curTrans.setObjectArray( theOwner.transactions() )  I'd expect to set ERXBatchingDisplayGroup up for Transaction and use a qualifier like "owner = $owner and date >= $startMonth and date < $endMonth"  Passing in theOwner.transactions() is likely to remove a lot of the benefit.
>
>
> I don't use model (or wherever you are getting this from) display groups, so I don't know what do tell you.  In code it would look something like this:
>
>
>            dataSource = new EODatabaseDataSource(editingContext(), entityName());
>
>            dataSource.fetchSpecification().setPrefetchingRelationshipKeyPaths(prefetchingRelationshipKeyPaths());
>            dataSource.fetchSpecification().setRefreshesRefetchedObjects( refreshesRefetchedObjects() );
>            dataSource.fetchSpecification().setIsDeep( true );
>            dataSource().fetchSpecification().setQualifier(qualifier());
> 	    displayGroup.setDataSource(dataSource);
> <...>
>> What do I need to do to set the data source, I thought that <setObjectArray> was the way to do it, but no, it always crashes?
>
> I've sketched out what I do, but I lifted that from other pieces of code, so it is only a rough sketch.

Below is a another/similar sketch of usage of ERXBatchingDisplayGroup that I'm using. I've had to adjust a little from what I do as I'm subclassing all of ERXBatchingDisplayGroup, EOArrayDataSource, ERXDatabaseDataSource.

with regards,
--

Lachlan Deck


public ERXBatchingDisplayGroup getDisplayGroup()
{
	if ( this.displayGroup == null )
	{
		this.displayGroup = new ERXBatchingDisplayGroup();
		getDisplayGroup().setDelegate( new MyDefaultDisplayGroupDelegate() );

		EODataSource dataSource = null;
		if ( hasObjects() )
		{
			EOArrayDataSource arrayDataSource = new EOArrayDataSource(...);
			arrayDataSource.setArray( getObjects() );
			dataSource = arrayDataSource;
		}
		else
		{
			EOFetchSpecification spec = new EOFetchSpecification( getEntityName(), getQualifier(), getSortOrderings() );
			spec.setUsesDistinct( true );
			spec.setRefreshesRefetchedObjects( false );

			ERXDatabaseDataSource dbDataSource = new ERXDatabaseDataSource(...);
			dbDataSource.setFetchSpecification( spec );
			dbDataSource.setRefreshesRefetchedObjects( false );

			dataSource = dbDataSource;
		}
		getDisplayGroup().setDataSource( dataSource );
		if ( getObjectsPerBatch().intValue() > 0 )
		{
			getDisplayGroup().setNumberOfObjectsPerBatch( getNumberOfObjectsPerBatch() );
		}

		getDisplayGroup().fetch();
		if ( getBatchIndex() != null ) // e.g., from query param
		{
			getDisplayGroup().setCurrentBatchIndex( getBatchIndex() );
			getDisplayGroup().fetch();
		}
	}
	return this.displayGroup;
} _______________________________________________
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

References: 
 >back to ERXBatchingDisplayGroup instead of ERXDisplayGroup (From: Baiss Eric Magnusson <email@hidden>)
 >Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup (From: Chuck Hill <email@hidden>)

  • Prev by Date: Entity Modeler: _deletedEntityNamesInObjectStore in index.eomodeld
  • Next by Date: Re: WODirectConnectEnabled false resource paths problem
  • Previous by thread: Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup
  • Next by thread: Re: back to ERXBatchingDisplayGroup instead of ERXDisplayGroup
  • Index(es):
    • Date
    • Thread