• 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
ERXBatchingDisplayGroup and insertObjectAtIndex
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ERXBatchingDisplayGroup and insertObjectAtIndex


  • Subject: ERXBatchingDisplayGroup and insertObjectAtIndex
  • From: David Avendasora <email@hidden>
  • Date: Sun, 27 Feb 2011 08:59:20 -0500

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

  • Follow-Ups:
    • Re: ERXBatchingDisplayGroup and insertObjectAtIndex
      • From: Anjo Krank <email@hidden>
  • Prev by Date: Re: Wonder update #231
  • Next by Date: Re: Where's the "Add Entry" button for the userInfo dictionary ?
  • Previous by thread: Re: Wonder update #231
  • Next by thread: Re: ERXBatchingDisplayGroup and insertObjectAtIndex
  • Index(es):
    • Date
    • Thread