Re: ERXBatchingDisplayGroup and insertObjectAtIndex
Re: ERXBatchingDisplayGroup and insertObjectAtIndex
- Subject: Re: ERXBatchingDisplayGroup and insertObjectAtIndex
- From: Anjo Krank <email@hidden>
- Date: Sun, 27 Feb 2011 17:59:52 +0100
The batching DG has very different semantics than the non-batching one. Basically, all of the EC changing stuff won't work as planned. You can safely only use it for querying large data sets.
You should only add a ticket if you also provide a fix, which I estimate is very hard to do correctly. (EG, you need to insert the items in the correct sort order, so that re-loading the page will put them where they belong, filter out deleted objects etc.)
Cheers, Anjo
Am 27.02.2011 um 14:59 schrieb David Avendasora:
> Hi All,
>
> Is there a reason why the ERXBatchingDisplayGroup wouldn't increment the _rowCount variable when you call insertObjectAtIndex?
>
> If you have a BDG that has a rowCount() that is an exact multiple (including 0) of the numberOfObjectsPerBatch() and you insert a new object, the rowCount() doesn't change and therefore neither will the batchCount(). Since the batchCount() didn't increase, any objects that would have been displayed in the last (new) batch are not displayed, and won't be until you refetch, even if you sort.
>
> Overriding insertObjectAtIndex in ERXBatchingDisplayGroup like this:
>
> @Override
> public void insertObjectAtIndex(Object createObject, int newIndex) {
> super.insertObjectAtIndex(createObject,
> newIndex);
> setRowCount(_rowCount + 1);
> }
>
> and then modifying setRowCount to also call updateBatchCount()
>
> public void setRowCount(int rowCount) {
> _rowCount = rowCount;
> updateBatchCount();
> }
>
> will fix the problem I'm having, but I don't know if I'm missing some other problem that this will cause.
>
> If this is the correct change to make, then we should also override deleteObjectAtIndex as that will change the rowCount as well.
>
> @Override
> public boolean deleteObjectAtIndex(int anIndex) {
> boolean objectDeleted = super.deleteObjectAtIndex(anIndex);
> if (objectDeleted) {
> setRowCount(_rowCount - 1);
> }
> return objectDeleted;
> }
>
> Does anyone have any input?
>
> If not, I'm going to create a Jira ticket to patch ERXBatchingDisplayGroup.
>
> Dave
> _______________________________________________
> 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
_______________________________________________
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