I am using an UltraGrid to display data from our database. We batch data as there may be many many records in the table. We have added logic to the InitializeLayout of the UltraGrid to create an appearance, set the backcolor of the appearance to red and then add the appearance to the appearances collection. We then added logic to the InitializeRow of the UltraGrid to check the value of a cell and set the Appearance of the cell based on the cell value. What we are running into is the GetCellValue is causing the bindingsource's offend event to fire until all records have been retrieved from the database. As a test if I remove the GetCellValue line and just set the appearance for all rows everything works as expected (batching). Has anyone seen this?
METHOD
PRIVATE VOID ORSGrid_InitializeLayout( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs ):
DEFINE VARIABLE oEDIException AS Infragistics.Win.Appearance NO-UNDO.
oEdiException =
NEW Infragistics.Win.Appearance().
oEDIException:BackColor = System.Drawing.Color:Red.
iEDIExceptionAppearance =
e:Layout:Appearances:Add(oEDIException).
DELETE OBJECT oEdiException NO-ERROR.
DELETE OBJECT e NO-ERROR.
RETURN.
END METHOD.
METHOD
PRIVATE VOID ORSGrid_InitializeRow( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UltraWinGrid.InitializeRowEventArgs ):
/* the GetCellValue is causing the offend to fire until all records are retrieved from the db */
IF UNBOX (e:ROW:GetCellValue(e:ROW:Band:Columns["StoreId"])) = "DIS" THEN.
ASSIGN
e:ROW:Cells["OrderNum"]:Appearance = THIS-OBJECT:gridPOHdr:DisplayLayout:Appearances[iEDIExceptionAppearance]
e:ROW:Cells["SeqNum"]:Appearance = THIS-OBJECT:gridPOHdr:DisplayLayout:Appearances[iEDIExceptionAppearance].
DELETE OBJECT e NO-ERROR.
RETURN.
END METHOD.
Roger,
Don't know if you figured this out yet...
We had the same issue when batching data in a grid and exporting to Excel or Pdf documents. Those functions would keep filling the grid until all the data was fetched. We only wanted the current grid contents to be exported.
To fix it we unsubscribe from the OffEnd event while processing and then re-subscribe once the process was complete.
Jim
Jim,
We do something similar by setting the bindingsource:Batching = FALSE.
thanks.