Two way batching and ultragrid problems

Posted by dhubbuck on 07-Dec-2010 06:38

Hi

I have a problem with the ultragrid and trying to implement two way batching.

I have followed John Sadd walkthrough

http://download.psdn.com/media/architect_video/DataUpdatesBatching/DataBatching_Notes.pdf

and the Batching, Sorting and Filtering by Håvard Danielsen

https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1188.batching-sorting-and-filtering-with-abl.aspx

What we have done is to take the simple forward batching example and implement two-way batching.

In our testing we hit a few issues with the previous batch implementation when a user presses the cursor up key.  While testing the beforeregionscroll event a debugging message was shown and the up key functionality worked.  When the message was removed the grid got stuck on the top line.

The Ultragrid is obviously doing some work Asynchronously.

Digging futher into the problem we needed to perform an ultragrid:refresh() which seemed to work.

My question is when should we call the ultragrid:refresh() method and is there some bug between the bindingsource and the grid when implementing batching and not using the offend event of the bindingsource.

What would be good is an example from progress carrying on from the simple forward batching example that extends the model to two-way batching.  Just so the interaction between the ultragrid and a bindingsource can be seen in more detail.

Thanks for all the samples and walkthroughs that are appearing they are helping.

We are really trying hard to push the new Advanced GUI and OOABL features and  initially working with a model that connects directly to the database.  The appserver will then hopefully fit in later.

Thanks again

Dale

All Replies

Posted by maura on 08-Dec-2010 08:48

It's hard to answer your question concerning the use of the ProBindingSource's refresh method without seeing your code.

Looks like what you're interested in is an OffHome event for the ProBindingSource. Haarvard added an enhancement request

(OE0174023) which is currently scheduled for v 11.0 which is asking for the addition of the OffHome event for the ProBindingSource.

Maura Regan

Posted by dhubbuck on 08-Dec-2010 09:09

Hi Thanks for the reply.

It was actually the grids refresh method that fixed the problem.  I  was just wondering if there was a best practise like call the method after you have altered certain things.

Not to worry.

Sample method

METHOD

PRIVATE VOID ultraGrid1_BeforeRowRegionScroll( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UltraWinGrid.BeforeRowRegionScrollEventArgs ):

DEFINE VARIABLE iRowsAdded AS INTEGER NO-UNDO.

DEFINE VARIABLE lLastSalesOrder AS LOGICAL NO-UNDO.

DEFINE VARIABLE isSelected AS LOGICAL NO-UNDO.

IF /* NOT mlSuppressBatching and using pindingsource:batching property */ e:NewState:ScrollPosition = 1 and mlPrevSalesOrderActive THEN

DO:

/* the active row will remain ordinally positioned (not including the new SalesOrder)*/

/* IF VALID-OBJECT(ultraGrid1:ActiveRow) THEN */

/* DO: */

/* IF ultraGrid1:ActiveRow:Selected THEN */

/* ASSIGN */

/* lIsSelected = TRUE */

/* ultraGrid1:ActiveRow:Selected = FALSE.*/

/* END. */

/* */

/* mlSuppressBatching = TRUE.*/

/* Set mouse pointer to wait */

System.Windows.Forms.Cursor:

Current = System.Windows.Forms.Cursors:WaitCursor.

/* just repositions restart-rowid at the moment */

moSalesOrder:FetchPrevBatch().

/* Fetch the batch of data */

moSalesOrder:FetchData(

INPUT "",

INPUT TRUE,

OUTPUT iRowsAdded,

OUTPUT lLastSalesOrder).

/* Set mouse pointer to default */

System.Windows.Forms.Cursor:

Current = System.Windows.Forms.Cursors:Default.

/* move to bottom of latest batch */

bsSalesOrder:

Position = irowsadded.

/* seems to need this due to some async issue */

Ultragrid1:

Refresh().

/* if the refresh was not used then it got stuck on line 1  */

/* if the refresh was not used but a message view-as was used the grid sorted itself out after saying ok to the message box  */

/* set the first row ScrollRegion to the last batch row */

UltraGrid1:ActiveRowScrollRegion:FirstRow = ultragrid1:Rows[iRowsAdded].

/* used to select last row */

Ultragrid1:Rows[iRowsAdded]:Activate().

UltraGrid1:ActiveRow:

Selected = true.

mlSuppressBatching =

FALSE.

e:cancel=TRUE.

/* if valid-object(ultraGrid1:ActiveRow) then */

/* do: */

/* if lisSelected then */

/* ultraGrid1:ActiveRow:Selected = true.*/

/* end. */

END.

END METHOD.

Good to hear about these internal enhancement requests.

Thanks

Dale

This thread is closed