Hello,
I have a two band UltraGrid in virtual mode. The data in my data source constantly change, including child record collections. It seems that the InitializeRowsCollection is only fired once for each parent row. Is there a way to force InitializeRowsCollection to fire again?
Thanks,Shaolin
Hello Shaolin,
There is no way to force InitializeRowsCollection to fire manually. If you describe what you want to accomplish by firing InitializeRowsCollection again, I can look into a strategy to accomplish this instead of InitializeRowsCollection.
Please let me know if I can further assist you.
Hi John,
Thanks for your response!
As I stated in my original question, the data in my own data source constantly change, including child record collections. The data in my own data source are added, updated and removed by work threads. The number of rows in any child row collection is changed all the time, so event InitializeRowsCollection has to be fired. When there is any data change in my data source, I will call:
ultraDataSource.Rows.SetCount(newCount);ultraGrid.Rows.Refresh(RefreshRow.FireInitializeRow);
The InitializeRow event is forced to fire this way. I do not see event InitializeRowsCollection is fired.
Shaolin,
The InitializeRowsCollection is only fired when the band is first created. As long as that band continues to exist, all modifications can be made to that same collection. When those modifications are submitted to the RowsCollection, InitializeRow is fired. It may be more appropriate to apply the logic you want to the InitializeRow event instead.
Please let me know if I can be of further assistance.
Hi Mike,
Okay, it was my mistake that I thought GetChildRows would return all child rows for the specified child band.
Thanks so much,Shaolin
Hi,
You answered your own question. You use the GetChildRows method. This returns you the child rows collection of that row. Then you call SetCount on it.
I need the child row collection. Let's assume we have two bands. I have a row, called Row1, in the root band that have initially have five children, so there are five child rows under Row1. A few seconds later, two more children needs to add to this parent row Row1. I can get this Row1 from my UltraDataSource. Now I need to get the child row collection of Row1. I know Row1's child row collection have five items and I need to set its Count to 7.
Shaolin said:It seems I cannot find a method to get child UltraDataRow collection for a parent UltraDataRow object from UltraDataSource. UltraDataRow has a couple of GetChildRows methods and they return all child rows in a child band.
I'm not sure what you are asking. You seem to have answered your own question.
Shaolin said:How can I get the associated rows collection in the UltraDataSource, by going through all child data rows in the child band?
UltraDataRow has both a Parent and a ParentCollection property. Is that what you are looking for?
Thanks so much for your response!
It seems I cannot find a method to get child UltraDataRow collection for a parent UltraDataRow object from UltraDataSource. UltraDataRow has a couple of GetChildRows methods and they return all child rows in a child band.
Mike Saltzman said:All you need to do is get the associated rows collection in the UltraDataSource and call SetCount on that collection.
How can I get the associated rows collection in the UltraDataSource, by going through all child data rows in the child band?
My own data source only holds a list of top level records and each record contains a child collection. Of course, a child record can have its own children. I only know the number of records in the top level.
Your help is greatly appreciated!
Thanks again,Shaolin