When calling the BindingSouce:RefreshAll() method, the current Position seems to get lost and reset to 0.
Is this intended behavior? Can it be suppressed?
I'm currently creating a custom BindingSource which has SuspendPositionChanged/ResumePositionChanged methods so I can suppress any listeners from getting the event when calling RefreshAll + reset original position, but not having the position change at all would be even better.
Anyone from Progress can comment on this?
DEFINE VARIABLE BindingSourcePosition AS INTEGER NO-UNDO.
BindingSourcePosition = BindingSource:Position.
/* Update data here... */
BindingSource:Position = BindingSourcePosition.
BindingSource:ResumePositionChanged(). /* And nobody noticed a thing... */
Yes, this is done on purpose. When you call RefreshAll(), it is generally because the set of records has changed. So the current position may either no longer correspond to any row at all, or it may correspond to a different row than before. So maintaining it, in the general case, doesn't really make any sense - to me anyway!
Why are they calling RefreshAll()?
We have a grid (backed by a BindingSource bound to a query on a temp-table) where you can multi-select records and apply an operation on them. This operation executes on the AppServer and returns a temp-table of changed records. These changes are then copied over the client temp-table and the UI is refreshed by calling RefreshAll().
Since the query result set doesn't change, we don't need to reopen the query and RefreshAll() is sufficient.
But after the call to RefreshAll(), the active row is now the first row instead of the original one...
By the way, my pseudo code was missing a line, added it now...