Posted 16 October 2019, 1:57 pm EST
Hello support!
We encountered a case where the DataTree ( https://www.grapecity.com/samples/datatree ) was a perfect fit, and it has worked well for the most part. However, my use-case requires me to set auto-incrementing string values whenever a new row is added (Think “Sample 1”, “Sample 2”, etc.). Since they’re strings, I can’t use the auto-increment feature of the DataTables bound to the DataTree. I have attached handlers to both the BeforeAddRow and AfterAddRow events, but they never seem to fire. Even when added as a custom override in the DataTree itself:
public void ShowChildLevel()
{
C1FlexDataTree parent = this;
int level = 0;
while (parent.Parent is C1FlexDataTree)
{
level++;
parent = parent.Parent as C1FlexDataTree;
}
if (level == 0)
{
MessageBox.Show("I am parent");
}
else
{
MessageBox.Show("I am child: " + level.ToString());
}
}
protected override void OnAfterAddRow(RowColEventArgs e)
{
ShowChildLevel();
base.OnAfterAddRow(e);
}
neither event ever fires. I’ve overriden other events and can see them trigger breakpoints, so it’s not something wrong with the overriding or attaching in themselves. I can’t see anything in the DataTree that would be supressing these events, so I’m at a loss.
While testing the problem, I noticed that the AfterDragColumn event also doesn’t fire in the general case, but does fire when the whole DataTree is selected. I don’t need the AfterDragColumn event, but it may be a clue as to the cause.
I’m currently looking at ways to try and trigger the AddRow events manually using the events I know do fire, but I’d really prefer to use those events directly.
Cheers,
-Alex