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 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