Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
UltraDataSource adding childbands dynamically causing grid row initialisation race condition?
posted

Background

I am using the UltraDataSource to bind to an UltraGrid in LoadOnDemand mode. The ultradatasource receives updates after it is bound to the grid and the first update is very large so I lock on an object and process the updates.

The hierachy of the data being processed is such that there are up to 15 top level Rows all with their own Bands - which are childbands of UltraDataSource's Band property.

These top level rows have at least one child row each and in some cases these child rows have child rows themselves - which have a different Band.

I add the top level bands at start up - because i know the columns - but there are no rows. When the rows arrive in this initial update i have to add the grand child's band to the row. I do that with this code:

Rows[ParentRowIndex].GetChildRows(ParentRowBandName)[ParentRowIndex].Band.ChildBands.Add("ChildBandName")

The above is an abridged version of my code which has checks for nulls etc.

 

Once the child band is added i add the child band's columns.

My 2 questions

1. When i add the childband columns i notice the UltraGrid's RowInitializeRow event gets fired, but the data has not been set yet in the datasource. Is there a way i can prevent the row init from firing until the update has finished processing?

2. When adding the columns to the child band the grid loading (which has a lock so get cell data requested handler is blocked until this is complete) takes a lot longer than if columns are added to the bands before binding to the grid.

I know the above because i moved the top level bands's column adding to initialisation of the ultradatasource before binding and it sped it up, problem is i dont know which child rows have grandchildren so i have to add the columns when those grand child rows arrive in an update. i know the above has been covered in other threads - suggestions such as begin / end update and row synching but that has not made much of a difference. Any other ideas are definitely weclome.

 FYI - during testing the first update has 15 top level rows each with 36 child rows and then about 10 of those child rows have grand child rows. The top level band has one column, the child band has 71 columns and the grandchild's band has 16 columns.