Im using 13.1 controls... I have 2 grids grdMain and grdSupp. Both have layouts dependent on a couple of rules. If rule 1 is invoked then certain cells are edit enabled and background colored yellow. If rule 2 is invoked then no cells are editable and the background color is set to color.empty.
When I reset to force rule 2, [grdSupp.Rows.Refresh(RefreshRow.FireInitializeRow);] fires and InitializeRow for grdSupp gets called. However when I call
[grdMain.Rows.Refresh(RefreshRow.FireInitializeRow);] InitializeRow does NOT fire.
My question is what would inhibit the InitializeRow event from firing?
Hello Jeff,
Thank you for posting in our forum.
One possible reason for some event not firing could be if you have disabled them through UltraGrid’s EventManager. Please let me know if you are working in your application with EventManager in order to control the invokes of event procedures.
Please check also if you are correctly handle the InitializeRow event of your main grid.
If you are handle correctly the InitializeRow event and in the same time you are not working with EventManager I will need a small sample solution reproducing this behavior in order to be able to investigate this further.
Please let me know if this information helps you to solve your issue.
Looking forward to your reply.
I don't use EventManager. However I did figure out what the problem is:
RefreshRow.FireInitializeRow is affected by whether or not Group By is turned on. When I turn Group By off then my break point gets hit when I do [grdMain.Rows.Refresh(RefreshRow.FireInitializeRow);] So I think this is a bug with the 13.1 ultragrid. Oh and my grdSupp does NOT use group by... that's the difference between the 2 grids.
I don't think I need to create a test sample project, but you can. My next question is: is there a work around? I would like to have my group by layout and not have to reload the grid with data just to get the InitializeRow to fire. :(
thanks
Yes, once you group, it creates a hierarchy of row, so you need to pass in true for recursive. :)
Ok, tried that .... still did not work:
Here's my code:
resetToolStripMenuItem.Click += delegate
{
grdMain.Rows.ExpandAll(true);
grdMain.Update();
grdMain.Rows.Refresh(RefreshRow.FireInitializeRow);
};
I tried the following and this seems to work...
grdMain.Rows.Refresh(RefreshRow.FireInitializeRow,true);
I set the second parameter for recursion to true.
Try calling:
row.ExpandAll();
grid.Update(); // This forces a paint
and then Refresh(FireInitializeRow)
I use Rows.ExpandAll(true); but the event InitializeRow still does not fire. I need to use the InitializeRow event as this is where I have rules dictating whats editable and whats not at whatever point and time.
InitializeRow fires for Data Rows. There's a separate event (InitiailizeGroupByRow) for GroupbyRows. If you grid is grouped, then the root-level rows are GroupByRows, not data rows. So you just need to handle the InitiailizeGroupByRow event.
If you are trying to fire InitializeRow for the data rows underneath the GroupByRows, then you may need to expand the GroupByRows first, either by calling ExpandAll of setting Expanded to true on the rows you want.